Jump to content

  • Log In with Google      Sign In   
  • Create Account

Banner advertising on our site currently available from just $5!


1. Learn about the promo. 2. Sign up for GDNet+. 3. Set up your advert!


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


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
7 replies to this topic

#1 Cydriic   Members   -  Reputation: 174

Like
1Likes
Like

Posted 29 June 2014 - 05:24 PM

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?



Sponsor:

#2 L. Spiro   Crossbones+   -  Reputation: 17640

Like
7Likes
Like

Posted 29 June 2014 - 05:33 PM

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

Edited by L. Spiro, 29 June 2014 - 05:34 PM.


#3 swiftcoder   Senior Moderators   -  Reputation: 12709

Like
8Likes
Like

Posted 29 June 2014 - 06:29 PM

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 - Software Engineer @Amazon - [swiftcoding]


#4 bwhiting   Members   -  Reputation: 998

Like
1Likes
Like

Posted 30 June 2014 - 09:57 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).



#5 slicer4ever   Crossbones+   -  Reputation: 4316

Like
0Likes
Like

Posted 30 June 2014 - 03:14 PM

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.

#6 swiftcoder   Senior Moderators   -  Reputation: 12709

Like
0Likes
Like

Posted 30 June 2014 - 04:37 PM


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 - Software Engineer @Amazon - [swiftcoding]


#7 ankhd   Members   -  Reputation: 1547

Like
0Likes
Like

Posted 30 June 2014 - 07:54 PM

if you are using shader you could do this.

 

RasterizerState DisableCulling
{
    CullMode = NONE;
};

 

 

technique10 DrawTech
{

 

SetRasterizerState( DisableCulling );

}



#8 Cydriic   Members   -  Reputation: 174

Like
0Likes
Like

Posted 01 July 2014 - 08:47 AM

Thanks guys, helps a lot.






Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS