texture-mapping

Quad Strip Texturing Distortion

时光怂恿深爱的人放手 提交于 2019-12-01 09:11:00
I have a GL_QUAD_STRIP that I am texture mapping. The quad strip folds back on itself to form a UV sphere. Essentially, the quad strip is not generally made of rectangles--instead, trapezoids. I am getting texture distortion issues. The texture coordinates are correct (for example, they line up nicely where they should). The issue is on the trapezoidal faces themselves. I would expect texels towards the larger end of a trapezoidal face to subtend larger area, yet the face seems broken into two triangles. It looks similar to affine texture mapping (but I don't think it is; it still seems

Mapping an image onto a set of coordinates

穿精又带淫゛_ 提交于 2019-12-01 09:08:45
问题 I have a typical source image with a 3:4 aspect ratio. I also have a set of coordinates that I need to map the image onto in a separate image. The coordinates are not perfectly rectangular; if anything they define an irregular mesh. So for example, (0,0) might map to (12,33), (120,0) => (127,36), (240,0)=>(226,13), etc. My goal is to get my source image to fit onto the new shape by mapping the source coordinates to the destination and applying distortion. What are some ways to accomplish this

Power of two textures

≡放荡痞女 提交于 2019-12-01 08:03:45
Can you explain me, why hardware acceleration required for a long time textures be power of two? For PCs, since GeForce 6 we achieved npot textures with no-mips and simplified filtering. OpenGL ES 2.0 also supports npot textures without mipmaps and etc. What is the hardware restriction for this? Just simplified arithmetics? I imagine it has to do with being able to use bitwise shift-left operations, rather than multiplication to convert an (x, y) coordinate to a memory offset from the start of the texture. So yes, simplified arithmetics, from a processor point of view. I'm guessing that it was

How to normalize image coordinates for texture space in OpenGL?

旧城冷巷雨未停 提交于 2019-12-01 07:42:33
问题 Say I have an image of size 320x240 . Now, sampling from an sampler2D with integer image coordinates ux, uy I must normalize for texture coordinates in range [0, size] (size may be width or height). Now, I wonder if I should normalize like this texture(image, vec2(ux/320.0, uy/240.0)) or like this texture(image, vec2(ux/319.0, uy/239.0)) Because ux = 0 ... 319 and uy = 0 ... 239 . The latter one will actually cover the whole range of [0, 1] correct? That means 0 corresponds to the e.g. left

Quad Strip Texturing Distortion

大兔子大兔子 提交于 2019-12-01 07:24:54
问题 I have a GL_QUAD_STRIP that I am texture mapping. The quad strip folds back on itself to form a UV sphere. Essentially, the quad strip is not generally made of rectangles--instead, trapezoids. I am getting texture distortion issues. The texture coordinates are correct (for example, they line up nicely where they should). The issue is on the trapezoidal faces themselves. I would expect texels towards the larger end of a trapezoidal face to subtend larger area, yet the face seems broken into

How to plot a surface with a texture map

非 Y 不嫁゛ 提交于 2019-11-30 15:33:24
I want to plot a surface with a texture map on it, but the conditions are not the "ideal" ones. first lets explain what I have. I have a set of points (~7000) that are image coordinates, in a grid. This points do NOT define perfect squares. IT IS NOT A MESHGRID . For the sake of the question, lets assume that we have 9 points. Lets ilustrate what we have with an image: X=[310,270,330,430,410,400,480,500,520] Y=[300,400,500,300,400,500,300,400,500] Lets say we can get the "structure" of the grid, so size1=3; size2=3; points=zeros(size1,size2,2) X=[310,270,330; 430,410,400; 480,500,520] Y=[300

Vulkan texture rendering on multiple meshes

末鹿安然 提交于 2019-11-30 07:14:37
问题 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(...); //

Texture mapping in MATLAB

那年仲夏 提交于 2019-11-29 18:56:52
问题 I have points in 3D space and their corresponding 2D image points. How can I make a mesh out of the 3D points, then texture the triangle faces formed by the mesh? 回答1: Note that the function trisurf that you were originally trying to use returns a handle to a patch object. If you look at the 'FaceColor' property for patch objects, you can see that there is no 'texturemap' option. That option is only valid for the 'FaceColor' property of surface objects. You will therefore have to find a way

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

喜你入骨 提交于 2019-11-29 18:11:11
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 = THREE.NearestFilter; t[i].minFilter = THREE.NearestFilter; t[i].generateMipmaps = false; materials.push(

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

寵の児 提交于 2019-11-29 10:56:49
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 I get (in this case a pyramid): This is the code: loader.load(jsonParam.url, function (geometry) { var