Jump to content
  • Advertisement
Sign in to follow this  
JavaLucki

OpenGL opengl shadows - what kind should i use?

This topic is 1224 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hi there,

I read some stuff about shadows in opengl, but I don't know what kind I should use.

I was doing some changes on my engine(c#, opentk) and stopped at shadows. I never used them, but better graphics need shadows.

So the question is: what kind of shadow (shadow-mapping, shadow volumes, or whatever) should I use?

 

JavaLucki

Edited by JavaLucki

Share this post


Link to post
Share on other sites
Advertisement

I'd say it depends on the game and different things. If you're setting up your own engine, you may want to implement various types. For static objects, using lightmaps or baking the shadows in the texture can be an easy and cheap way to implement shadows. If your game world is large, you'll likely want cascading shadow maps, or various other methods that handle large worlds better. If you have lots of light points, you'll want a different approach, etc, etc.

 

I'd start by examining what your current game would make the most use of, and implement that (or if you're just writing an engine, just start with your standard shadowmap and then go from there. They're tricky to implement at first, at least they were for me). For a robust engine, having the option of different shadow styles can be really handy, as different scenarios will call for different methods of shadow creation. But, this is also quite the work load to implement.

 

So perhaps just dig in with standard shadow maps, unless you're working on a game that has specific shadow needs.

Share this post


Link to post
Share on other sites

I say "modern" for "actual way".

Since he is learning, it can be a good catch to learn the actual way which will be the future used.

Ray tracing begins to be used a lot : AO, Lightmap, Shadow, GI, ...

Edited by Alundra

Share this post


Link to post
Share on other sites

While I am a guy who has been working a lot with real time ray tracing and even real time path tracing a lot, in general ray tracing approach is a huge problem, and that is acceleration structure for your scene.

 

Now typically for my standard rendering game engine I use a BVH (Bounding Volume Hierarchy) that contains single meshes in leaves (note mesh inside my game engine is a single vertex buffer object, optionally index buffer object ... packed in vertex array object + additional data) and each frame this BVH is re-built so I allow for dynamic objects. The re-building of BVH is not done using re-fit algorithm but full re-build (re-fit is ending up in bad BVH in general), which can be done quickly for thousands of objects.

 

For typical real time ray tracing scenario (or path tracing), I build BVH once (because I need to go as low as few triangles per leaf), and never re-fit(dynamic geometry is therefore a problem), yes I can re-build on demand, but it takes time (for Split-BVH algorithm which gives me very high quality tree, it can go even into minutes for more complex scene). You can go for hierarchical BVH - like in the upper case and have SplitBVH built for each separate mesh yes, that would work ... unless you have a lot of moving objects. Also noting that hierarchical BVH decreases performance compared to full SplitBVH.

 

So to speak - ray tracing shadows are good, as long as you have static only scene. Dynamic scenes... not that much, sadly (but hey - this can change with any new hardware, using lower quality but fast-build BVHs can give you enough speed for dynamic scenes, but you will be quite limited with geometry).

 

Honestly to the link ...  fix cascaded shadow maps ... they are looking really bad, honestly they are comparing one of the worst cascaded shadow maps ???implementation to ray traced shadows (is it intention?), they only use static geometry in both, and we don't see the scene geometrical complexity. This way the comparison is non objective and therefore useless!

 

Anyways the OP came for opinions, I can tell you what I'm using now inside the current rendering engine I use. Standard cascaded-shadow-mapping (allowing to choose from few heuristics to select cascades splits) for directional lights. Standard old fashioned shadow maps for spotlights and cube-maps for point lights. Each single shadow map is rendered into 'shadow map texture atlas' which is limiting memory spent on shadowing.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!