Jump to content

View more

Image of the Day

Inventory ! Va falloir trouver une autre couleur pour le cadre D: #AzTroScreenshot #screenshotsaturday https://t.co/PvxhGL7cOH
IOTD | Top Screenshots

The latest, straight to your Inbox.

Subscribe to GameDev.net Direct to receive the latest updates and exclusive content.


Sign up now

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

4: Adsense

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   

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?



#2 L. Spiro   Members   

25464
Like
7Likes
Like

Posted 29 June 2014 - 05:33 PM

*
POPULAR

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   

18215
Like
8Likes
Like

Posted 29 June 2014 - 06:29 PM

*
POPULAR

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] [GitHub]


#4 bwhiting   Members   

1543
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   GDNet+   

6667
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   

18215
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] [GitHub]


#7 ankhd   Members   

2301
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   

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.