View topic - Shadows with reversed triangle facing



All times are UTC + 1 hour


Post new topic Reply to topic  [ 12 posts ] 
Author Message
PostPosted: 04 May 2011, 11:44 
Moderator
User avatar

Joined: 26 Oct 2007, 15:21
I wish to thank the developers, specifically jK who revamped the shadow code and made its transformation matrix linear, for their valuable time and effort invested into improving engine features.

I would like to ask if the possibility of reversing the triangle facing on the shadow map would be possible?

Because currently many of Mr Bobs wonderful remakes have non closed volumes, and the shadows look buggy on those because of the shadowmap triangle direction inversion.

I feel that making the tri's on these models double sided would be very wasteful wrt. to tri count.

I know this next question will sound dumb, but is it possible to have the vertex shader animations done in lua unit rendering to pass along to the shadows and have the shadows be animated corresponding to the units? It may just have been me who screwed up this part, but I couldnt get this to work.

See the following screenshot for details.
Attachment:
shadowflip.jpg
shadowflip.jpg [ 11.9 KiB | Viewed 671 times ]


Top
 Offline Profile  
 
PostPosted: 08 May 2011, 19:07 

Joined: 13 Jun 2005, 15:37
Where does this model come from and how do I put it in a game? :)
I'm curious to see what it looks like in master :)


Top
 Offline Profile  
 
PostPosted: 08 May 2011, 21:34 
Moderator
User avatar

Joined: 26 Oct 2007, 15:21
The model is Mr Bobs core air repair pad. Checkout the mod from google code here: http://code.google.com/p/baremake/


Top
 Offline Profile  
 
PostPosted: 09 May 2011, 21:51 

Joined: 13 Jun 2005, 15:37
Tried it on master (b182bcbd686aef8e5913), sadly pretty much the same result:
Attachment:
shadows.jpg [122.76 KiB]
Downloaded 2 times

Was hoping it might be fixed with new shadow code, but alas :)


Top
 Offline Profile  
 
PostPosted: 10 May 2011, 22:28 
Moderator
User avatar

Joined: 26 Oct 2007, 15:21
Tried it it master too, though the shadows are much nicer now (linear :D) they still are back faced.

Is there a technical reason for the back faced shadowing? Like if front faces were used then everything would shadow itself?


Top
 Offline Profile  
 
PostPosted: 02 Jun 2011, 10:28 
Moderator
User avatar

Joined: 26 Oct 2007, 15:21
Wierd, its set the right way with features...

Image


Top
 Offline Profile  
 
PostPosted: 02 Jun 2011, 14:57 
Spring Developer

Joined: 08 Oct 2006, 15:58
That's not so strange, face-culling is disabled for features of any type during the shadow pass (because features are often modelled trees with non-manifold surfaces, and their shadows would otherwise look like those in your screenshots). Also, 3DO models of old tended to have gaps in them that became exposed with culling enabled.

For units the back-faces are always culled in both normal and shadow rendering (http://imageshack.us/f/546/screen00001.png), there is no "triangle direction inversion" (anymore). You only notice this in the shadow projection if a model is not a closed volume.


Top
 Offline Profile  
 
PostPosted: 02 Jun 2011, 15:21 
Spring Developer
User avatar

Joined: 28 Jun 2007, 06:30
Kloot wrote:
there is no "triangle direction inversion" (anymore)

Shouldn't the shadowmap then contain exactly the same triangles as the onscreen buffer?
In BD's examples the sun is above the units and so the sun looks on the _front_ faces. But they obviously aren't rendered instead the back faces are -> means culling is inverted in shadowpass.


Top
 Offline Profile  
 
PostPosted: 02 Jun 2011, 15:37 
Spring Developer

Joined: 08 Oct 2006, 15:58
Relevant OpenGL state (glFrontFace(GL_CCW), glCullFace(GL_BACK)) is the same in each pass, so it would have to be the shadow-matrix projection flipping an axis.

edit, after looking at it more closely: https://github.com/spring/spring/commit ... 74eef0b2be (-> http://imageshack.us/f/233/screen00000a.png)


Top
 Offline Profile  
 
PostPosted: 02 Jun 2011, 16:00 
Moderator
User avatar

Joined: 26 Oct 2007, 15:21
Oh my god I LOVE YOU!

This was one of the major obstacles in the path of the BA remake, as many buildings had holes in them. It also enables me to keep working on bump mapped ba :D


Top
 Offline Profile  
 
PostPosted: 02 Jun 2011, 16:19 
Moderator
User avatar

Joined: 29 Apr 2005, 00:14
Location: #moddev - join it!
0.83 is going to be awesome. :-)


Top
 Offline Profile  
 
PostPosted: 02 Jun 2011, 17:56 
Content Developer
User avatar

Joined: 13 Jan 2005, 00:46
Location: ModalitÃ
<3 klooty

Behe, roamz, nao!


Top
 Offline Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 12 posts ] 

All times are UTC + 1 hour


Who is online

Users browsing this forum: No registered users and 0 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB® Forum Software © phpBB Group

Site layout created by Roflcopter et al.