uv-mapping

UV unwrap on Runtime optimization

谁说我不能喝 提交于 2020-02-05 03:38:43
问题 I'm trying to create UVs @ runtime, I'm using a BOX type UVs (similar to BOX UVW in 3ds max) and based my calculation on the face orientation. I know it's not a good option to create it a runtime but I have no choice :( it's saved after calculation, so I made it once. BUT I take 40 seconds for a 30000 Vertices... too long Is there any optimization in my code that can be made? . Here is my code feel free to use if you have <5000 vertices Mesh: public static void CreateUV(ref Mesh mesh) { int i

Three.js - Vertex Shader UV variable return only 0,0

喜你入骨 提交于 2020-01-15 09:19:28
问题 I loaded an object with OBJLoader. I want to use a Shader Material with a texture. I pass my texture to the uniforms parameters of the material. I pass the UV variable from the vertex shader to the fragment shader. But when I use the uv coordinate for mapping my texture I get always 0,0 or at least this is what it looks like. The whole object is coloured with the bottom left pixel of the texture. Here are my shaders: <script type='x-shader/x-vertex' id='vertex-shader'> uniform float u_time;

Three.js - Vertex Shader UV variable return only 0,0

匆匆过客 提交于 2020-01-15 09:19:07
问题 I loaded an object with OBJLoader. I want to use a Shader Material with a texture. I pass my texture to the uniforms parameters of the material. I pass the UV variable from the vertex shader to the fragment shader. But when I use the uv coordinate for mapping my texture I get always 0,0 or at least this is what it looks like. The whole object is coloured with the bottom left pixel of the texture. Here are my shaders: <script type='x-shader/x-vertex' id='vertex-shader'> uniform float u_time;

A-Frame / THREE.js, no textures simplified gltf[glb] models

我只是一个虾纸丫 提交于 2019-12-25 03:55:31
问题 After simplifying glb successfully with the answer in this post. The textures in are not being applied to the model any more (it appears completely black and unreflective(no material) How would I programmatically get the textures to work with this new simplified geometry? I think its something to do with the uv's but im not to sure how to have it work according to simplified geometry, if even possible. 回答1: THREE.SimplifyModifier currently does not preserve UVs in the geometry, which you'll

uv mapping works bad on low resolution (warning: lot of images)

旧城冷巷雨未停 提交于 2019-12-22 12:55:02
问题 TL;DR: is there a way to scale down both UV map and texture without losing the quality of the produced result? Full story: I'm trying to develop a simple rendering engine which would take UV map from .EXR file, put a texture on it and serve to the client. Whole process looks like this: from PIL import Image import numpy as np texture = Image.open("texture.png") texture_array = np.asarray(txt).transpose(1, 0, 2) # assume reading EXR file and grabbing only R and G channels from it uv = read_exr

Programmatically generate simple UV Mapping for models

◇◆丶佛笑我妖孽 提交于 2019-12-18 04:54:20
问题 Coming from this question I'm trying to generate UV Mappings programmatically with Three.js for some models, I need this because my models are being generated programmatically too and I need to apply a simple texture to them. I have read here and successfully generated UV mapping for some simple 3D text but when applying the same mapping to more complex models it just doesn't work. The texture I'm trying to apply is something like this: The black background it's just transparent in the PNG

Correct UV mapping Three.js

ぃ、小莉子 提交于 2019-12-17 20:31:35
问题 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 回答1: 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 ]

Finding UV coordinates of a point on material rendered on 3D cube in threejs

天大地大妈咪最大 提交于 2019-12-13 03:44:18
问题 I want to calculate the UV co-ordinates of a single point of a material rendered on 3D cube. I am finding the mouse pointer intersection with the camera ray using THREE.Raycaster as: mouse.x = (event.clientX / window.innerWidth) * 2 - 1; mouse.y = -(event.clientY / window.innerHeight) * 2 + 1; var vector = new THREE.Vector3(mouse.x, mouse.y, 1); vector.unproject(camera); var raycaster = new THREE.Raycaster(camera.position, vector.sub(camera.position).normalize()); var intersects = raycaster

Custom UVgenerator Three.js for extrudedgeometry

你说的曾经没有我的故事 提交于 2019-12-12 15:18:03
问题 I want to use a texture on the surface of my extruded geometry. I have been researching custom UVgenerators for a while now, and have found these related questions: 1.) How to apply a texture to THREE.ExtrudeGeometry? 2.) Loaded texture appears blurred, or like a single color. How to make the texture crisp and sharp However, the method proposed to divide my geometry points by 1000 and to mesh.scale.set(1000,1000,1) doesn't work because my geometry is no longer in the correct place. I would

Calculating uv texture coords for a procedurally generated polygon

核能气质少年 提交于 2019-12-12 14:22:06
问题 I have a shape like this: and the coordinates of the points are available (Vertices have x and y components) My texture is: A simple planar UV mapping gives me: and what I desire is: How to calculate vertex positions to get the desired mapping? Note that this is a math problem. Also, I can tolerate stretching, as long as the vertices fall on the grassy side. 来源: https://stackoverflow.com/questions/26397115/calculating-uv-texture-coords-for-a-procedurally-generated-polygon