Jump to content

  • Log In with Google      Sign In   
  • Create Account

FREE SOFTWARE GIVEAWAY

We have 4 x Pro Licences (valued at $59 each) for 2d modular animation software Spriter to give away in this Thursday's GDNet Direct email newsletter.


Read more in this forum topic or make sure you're signed up (from the right-hand sidebar on the homepage) and read Thursday's newsletter to get in the running!


lights, shadowmaps and render count


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
3 replies to this topic

#1 Ichi   Members   -  Reputation: 164

Like
0Likes
Like

Posted 30 July 2014 - 05:20 PM

hi

 

im about creating shadowmaps, having multiple lights of different types. If you have a look on following page

http://http.developer.nvidia.com/GPUGems/gpugems_ch12.html

at Example 12-1. Pseudocode for the Omnidirectional Shadow-Mapping Algorithm

you notice that they tell to render the scene 2 times for every light.

Ok, fine that maaay be much if i have much lights but its fine because i only need a single shadowmap texture.

Now i have a problem when it comes to point lights. for the shadow cubemaps i need 6 shadow maps. should i render the scene 2 times for every of the 6 faces (12 renders per point light) or have 6 shadow maps laying in vram(waste of ram kinda). 

 

the next problem is if i want to use things like motion blur or depth of field, mirrors or whatever, i need to render my scene multiple times per frame. that number is multiplied with the renders(shadow maps) i need for one full render and i dont want a scene so lowpoly that it could be rendered about 100 times each frame.

 

Do you have any advice for shadow maps? i kinda hate them, but they are also nice in some way. Also i need dynamic lighting

Thanks smile.png

Ichi

 

EDIT: also i have no idea about accessing shadow cubemap data with direction vectors. would be nice if someone could explain that. smile.png Thanks

EDIT2: just found out opengl supports cubemaps :s. ill have a look on that tomorrow


Edited by Ichi, 30 July 2014 - 08:18 PM.


Sponsor:

#2 Ashaman73   Crossbones+   -  Reputation: 8001

Like
0Likes
Like

Posted 30 July 2014 - 11:49 PM


it could be rendered about 100 times each frame.

Well, yes, and this is the problem...

 


Do you have any advice for shadow maps?

Use shadowmaps really rarely,especially omnidirectional shadow maps. There are some (nasty/ugly) tricks, but eventually many shadowmaps in modern scene complexetiy is still a problem which has not been solved in a nice and elegant way. If you want to go the brute force way (render the scene multiple times), then you will run in performance issues really quickly (depends on scene complexity).

 

Take a look at modern games and watch them really carefully, you will see, that most games have one major shadow map (sun) and at times some extra shadow maps, almost never an omnidirection one, on the other hand they have lot of (shadowless) lights.



#3 Ohforf sake   Members   -  Reputation: 1832

Like
1Likes
Like

Posted 31 July 2014 - 12:34 AM

You need to render once for every shadow map that you create, that is true, but you do not need to render once per light source. That is a severe oversimplification of forward rendering. Modern rendering methods like deferred and tiles/clustered forward can get away with less.

Also note, that rendering your scene is usually dominated by evaluating complex shaders, and writing to fat buffers with lots of bytes per pixel. None of which you have to do when you render the shadow map. Also, you only need to render those objects into the shadow map, that are actually within the range of that light, so rendering a shadowmap is not as expensive as your ordinary render pass.

#4 BlueSpud   Members   -  Reputation: 447

Like
0Likes
Like

Posted 10 August 2014 - 08:53 AM

I myself have been thinking about this problem for quite a long time now, just in the back of my head without really reading anything on it. If you really needed to have several shadow maps, obviously drawing a scene with 300,000 polygons several times is going to be slow. If your scene is static besides the camera, you only need to render the shadow map once, and then your all good, since none of the geometry is changing. I've also heard that VBO's can be instanced to reduce the cost of rendering the same object multiple times, but Im not sure if it can be used for shadow maps, but I'd still look into it. If you need dynamic objects, such as a player's shadow, I would think it could be cheaper to do a frustum culling-type algorithm for each light on dynamic objects. If there is at least one object in the light's view, update the shadow map. Also then preform frustum culling and maybe a bit of occlusion culling to see if the camera can see the light. If it can't, why render the shadow map? I haven't tried anything, and they'll probably be fairly complex to implement, but Im sure that you'll see that these are a lot better than the brute force method. Good luck. 






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