About Store Forum Documentation Contact



Post Reply 
Textures & Scene Modification
Author Message
Chris Offline
Member

Post: #16
RE: Textures & Scene Modification
Thanks, I tried this already but it wasn't it. Darn, i've been stuck on this for 5 hours already. Pretty difficult to debug.
Do you think this may have anything to do with this:

If I project an objects texture coordinates into 3d space (part of the code i'm using in my mesh recreation maths), I get parts of them drawed on two sides of the 2d space - I can't get my head around as to why it's like this.

Edit: I solved the original problem, it was from poorly converted texture coordinates.
(This post was last modified: 05-10-2010 06:16 PM by Chris.)
05-05-2010 03:14 PM
Find all posts by this user Quote this message in a reply
Chris Offline
Member

Post: #17
RE: Textures & Scene Modification
Sorry to keep asking questions on this.

Do you know how I can access the 3d position of a pixel, in the pixel shader, even if its been previously changed in a vertex shader? i.e. you have, in a pixel shader:

Vec2 inTex: TEXCOORD0,
Vec inPos: TEXCOORD1,

texture_color = TransformPos(inPos);

however only inPos.x and inPos.y seem to contain relevant data, as i've previously projected the vertex to a 2d position.

I basically want to write a shader which sets the colour of each pixel to be the local 3d object space surface colour. But in my case, the vertex position has previously been changed to a 2d position - i.e. to a uv projection of the mesh.

Any ideas? Sorry if i'm not being clear enough.

Thanks for your huge help already,
Chris
05-10-2010 06:27 PM
Find all posts by this user Quote this message in a reply
Esenthel Offline
Administrator

Post: #18
RE: Textures & Scene Modification
but from uv you get the 3D pos right?
so you need to pass this 3D as additional TEXCOORD (for example out Vec outPos:TEXCOORD3 in vertex shader function)
05-10-2010 06:30 PM
Find all posts by this user Quote this message in a reply
Chris Offline
Member

Post: #19
RE: Textures & Scene Modification
Ah, so that's how that works smile

Thanks, this should be okay now!
05-10-2010 06:33 PM
Find all posts by this user Quote this message in a reply
Post Reply