Forum

Enabling texture wrapping in shaders

i have a Sphere node and want it to connect to a Phong shader. The Sphere should be textured with an earth map and nicely wrap around.

i encounter the well known issue texture wrapping (not to be confused with setting a texture sampler to wrap).

i remember that texture wrapping is a render state. i also think that in older versions the Wrap node was for setting that render state. While in the latest versions the Shaders do have a Render State input, the Wrap node still outputs a Sampler State. (which makes 50% sense, as the other pins are controlling a sampler state).

so - how to enable texture wrapping in a shader?

of course i can easily use an xfile for rendering a sphere, but this somehow questions the concept of the Sphere node.

and btw. any news about Sampler State pins for shaders?

the shaders all have an outcommented line:
//Wrap0 = U; // useful when mesh is round like a sphere

probably that is what you need to uncomment.

no news on the sampler state pins…

do you have a link on msdn with all sampler states? hard to find with mozilla grr :)

voila
(found with firefox)

ah. and here are the renderstates

//Wrap0 = U; // useful when mesh is round like a sphere
does NOT help. Tried that before.
Attached an example patch with textured Sphere.

PS: Sphere (DX9) works fine.

bugfix projection.zip (45.6 kB)

there is nothing you can do, the build in ex9 sphere is wrong. gregsn and me discussed this problem once at meso as we were trying joregs HDR sphere maps. at the end we had to build our own sphere …

@firefox: kindof. agreed. i was looking for a hlsl reference not a c++ one… anyway. thanks.