shader question re: texcoords

Forum for plugin, effect and behavior programmers. Please use the Help & Support forum for help using Construct.

Post » Tue Jan 20, 2009 10:38 pm

while some aspects of the shader implementation in construct (like the way parameters are specified, fore- and background-textures and the technique are named) are obvious from looking at the examples, i'm having trouble porting other shaders. mostly because of the omitted vertexshader, which breaks some of them in unexpected ways (related to world, view & projection spaces) that probably originate in wrong texture coordinates.

in which way are texture coordinates handled in construct? which spaces are handed to the pixelshader? and are there any hooks in the implementation concerning sampler states / address modes?

thanks for your time...
B
2
S
2
G
4
Posts: 171
Reputation: 1,792

Post » Tue Jan 20, 2009 10:46 pm

Effects run by being rendered to a window-sized render target, then transferred to the back buffer. The area processed is the object bounding box. So your texture coordinates are just the area of the bounding box in the window-sized texture. You can use the parameters detailed here to find these values in the shader.

Construct does all vertex calculations in software so there is no need for any vertex shader, although this means you may have to adapt the code.

You can set render states etc. like normal in shaders. Check out the additive (PS 0.0) effect, all it does is change render states (which is what 'PS 0.0' means - render states only).
Scirra Founder
B
359
S
214
G
72
Posts: 22,946
Reputation: 178,528

Post » Tue Jan 20, 2009 11:07 pm

thanks! i completely missed out on the wiki page :oops:
B
2
S
2
G
4
Posts: 171
Reputation: 1,792


Return to Construct engineering

Who is online

Users browsing this forum: No registered users and 0 guests