texture-mapping

Vulkan texture rendering on multiple meshes

喜夏-厌秋 提交于 2019-11-29 04:36:52
I am in the middle of rendering different textures on multiple meshes of a model, but I do not have much clues about the procedures. Someone suggested for each mesh, create its own descriptor sets and call vkCmdBindDescriptorSets() and vkCmdDrawIndexed() for rendering like this: // Pipeline with descriptor set layout that matches the shared descriptor sets vkCmdBindPipeline(...pipelines.mesh...); ... // Mesh A vkCmdBindDescriptorSets(...&meshA.descriptorSet... ); vkCmdDrawIndexed(...); // Mesh B vkCmdBindDescriptorSets(...&meshB.descriptorSet... ); vkCmdDrawIndexed(...); However, the above

OpenGL ES 2.0 Vertex Transformation Algorithms

送分小仙女□ 提交于 2019-11-29 04:19:52
I'm developing an image warping iOS app with OpenGL ES 2.0. I have a good grasp on the setup, the pipeline, etc., and am now moving along to the math. Since my experience with image warping is nil, I'm reaching out for some algorithm suggestions. Currently, I'm setting the initial vertices at points in a grid type fashion, which equally divide the image into squares. Then, I place an additional vertex in the middle of each of those squares. When I draw the indices, each square contains four triangles in the shape of an X. See the image below: After playing with photoshop a little, I noticed

OpenGL ES 2.0 texture distortion on large geometry GL_REPEAT

浪尽此生 提交于 2019-11-29 02:28:44
OpenGL ES 2.0 has serious precision issues with texture sampling - I've seen topics with a similar problem , but I haven't seen a real solution to this "distorted OpenGL ES 2.0 texture" problem yet. This is not related to the texture's image format or OpenGL color buffers, it seems like it's a precision error. I don't know what specifically causes the precision to fail - it doesn't seem like it's just the size of geometry that causes this distortion, because simply scaling vertex position passed to the the vertex shader does not solve the issue. Here are some examples of the texture distortion

How can I pass multiple textures to a single shader?

巧了我就是萌 提交于 2019-11-28 17:56:10
I am using freeglut, GLEW and DevIL to render a textured teapot using a vertex and fragment shader. This is all working fine in OpenGL 2.0 and GLSL 1.2 on Ubuntu 14.04. Now, I want to apply a bump map to the teapot. My lecturer evidently doesn't brew his own tea, and so doesn't know they're supposed to be smooth . Anyway, I found a nice-looking tutorial on old-school bump mapping that includes a fragment shader that begins: uniform sampler2D DecalTex; //The texture uniform sampler2D BumpTex; //The bump-map What they don't mention is how to pass two textures to the shader in the first place.

Correct UV mapping Three.js

只谈情不闲聊 提交于 2019-11-28 13:01:15
I'm trying to map the UV-texture correctly, but failing... I've got the next result in my app: The result isn't that I was awaiting. I want to have the next described view: The source code is here: http://pastebin.com/aDg981Bk You need to look at PlaneGeometry.js and understand how the UVs are set. Then you will be able to figure out how to reset them. This should work -- there are two triangles per "face". for(var i = 0; i < geometry.faces.length / 2; i++) { geometry.faceVertexUvs[ 0 ].push( [ new THREE.Vector2( 0, 0 ), new THREE.Vector2( 0, 1 ), new THREE.Vector2( 1, 0 ), ] ); geometry.faces

Seams on cube edges when using texture atlas with three.js

时光总嘲笑我的痴心妄想 提交于 2019-11-28 11:31:35
问题 I have seams between horizontal faces of the cube when use texture atlas in three.js. This is demo: http://jsfiddle.net/rnix/gtxcj3qh/7/ or http://jsfiddle.net/gtxcj3qh/8/ (from comments) Screenshot of the problem: Here I use repeat and offset: var materials = []; var t = []; var imgData = document.getElementById("texture_atlas").src; for ( var i = 0; i < 6; i ++ ) { t[i] = THREE.ImageUtils.loadTexture( imgData ); //2048x256 t[i].repeat.x = 1 / 8; t[i].offset.x = i / 8; //t[i].magFilter =

Map an image onto a sphere and plot 3D trajectories

泪湿孤枕 提交于 2019-11-28 09:30:24
What I would like to do is to define a sphere in the center of my 3D coordinate system (with radius=1), wrap a cylindrical planet map onto the sphere's surface (i.e. perform texture mapping on the sphere) and plot 3D trajectories around the object (like satellite trajectories). Is there any way I can do this using matplotlib or mayavi? Plotting trajectories is easy using mayavi.mlab.plot3d once you have your planet, so I'm going to concentrate on texture mapping a planet to a sphere using mayavi. (In principle we can perform the task using matplotlib, but the performance and quality is much

How to apply a texture to a custom geometry in Three.js

ぃ、小莉子 提交于 2019-11-28 04:12:16
问题 I successfully applied a texture to a cube geometry with this: var geometry = new THREE.CubeGeometry(10, 10, 10); var meshMaterial = new THREE.MeshPhongMaterial({ transparent: false, map: THREE.ImageUtils.loadTexture('/app/images/wood.jpg') }); meshMaterial.side = THREE.DoubleSide; var mesh = new THREE.Mesh(geometry, meshMaterial); With this I get a nice textured cube like this: Now I want to apply the same texture (512x512 jpg image) to a custom model I'm loading from an STL and this is what

Bump-map a sphere with a texture map

我是研究僧i 提交于 2019-11-28 02:30:15
We would like to bump-map a sphere with a texture map. However, the surface of the sphere has an area that is 10 times the area of the texture map(area for both in pixels). Describe different ways in which the texture map can be used for bump mapping. Spektre usually rectangle texture is used for spheres texture (u,v) coordinates are used as angles for spherical coordinates. The result is that texels are bigger near equator and smaller near poles. At poles all the texels merge to single pixel. This is how to do it texturing spheres normal/bump mapping When you use these maps (color,normal

OpenGL ES 2.0 Vertex Transformation Algorithms

前提是你 提交于 2019-11-27 22:20:44
问题 I'm developing an image warping iOS app with OpenGL ES 2.0. I have a good grasp on the setup, the pipeline, etc., and am now moving along to the math. Since my experience with image warping is nil, I'm reaching out for some algorithm suggestions. Currently, I'm setting the initial vertices at points in a grid type fashion, which equally divide the image into squares. Then, I place an additional vertex in the middle of each of those squares. When I draw the indices, each square contains four