Is there a way to define a front and back texture on a Quad

Started by
6 comments, last by Cydriic 9 years, 9 months ago

Hey Everyone,

Is there a way to have a front and back face on a quad , so that if I rotate the Quad, I can have a back texture on it that differentiates it from the front?

Advertisement
Put the front-facing texture in slot 0, the back-facing texture in slot 1, and use gl_FrontFacing or SV_IsFrontFace to read from one texture or the other in the shader.


L. Spiro

I restore Nintendo 64 video-game OST’s into HD! https://www.youtube.com/channel/UCCtX_wedtZ5BoyQBXEhnVZw/playlists?view=1&sort=lad&flow=grid

Or render 2 different quads at the same location, facing the opposite way to each other (you can even use the same vertices for each, and just wind the indices the opposite way).

Tristam MacDonald. Ex-BigTech Software Engineer. Future farmer. [https://trist.am]

I use the 2nd suggested method with a slight twist, I have different vertices (duplicates) used for the back so they can have unique uvs, so a texture atlas can be used (no swapping of textures or shader branches).

As always there are many way to sink a cat (or skin, both are mean if you ask me.. did I just invent a new saying by accident... I hope so).

Or render 2 different quads at the same location, facing the opposite way to each other (you can even use the same vertices for each, and just wind the indices the opposite way).

coudn't he just switch the culling direction?

Check out https://www.facebook.com/LiquidGames for some great games made by me on the Playstation Mobile market.


coudn't he just switch the culling direction?

Yes, but I'd be hesitant to recommend a state change in order to avoid drawing 4 vertices. The cost/benefit is not in our favour :)

Tristam MacDonald. Ex-BigTech Software Engineer. Future farmer. [https://trist.am]

if you are using shader you could do this.

RasterizerState DisableCulling
{
CullMode = NONE;
};

technique10 DrawTech
{

SetRasterizerState( DisableCulling );

}

Thanks guys, helps a lot.

This topic is closed to new replies.

Advertisement