grass shadows
im working with some grass rendering.. im rendering the grass using billboards... as described in gpu gems..
for lighting i use the terrain normal at the grass position and then i use the billboards texture normal and mix these to together for a "grass normal"...
but how would i go for shadows? i need a way that each grass texture will cast shadows on both terrain and other grass textures...
Don't use billboards for grass. Create little models, animate them to make them look like they're in a wind. Don't make them turn towards the camera and all your problems will be solved. Then just shadowmap them :)
This is how most games do it these days.
This is how most games do it these days.
In such an application, shadow volumes are almost completely out of the questions, so shadow maps are going to be your only option.
Note that with shadow maps you can use alpha testing (and alpha blending with variance shadow maps), so you can continue to use sprites, although you need to consider how they are going to work from the light's point of view.
Depending on the complexity of your grass, you may want to consider a probabilistic representation, such as Deep Shadow Maps, or variance shadow maps. It might turn out to be easier and better-looking to represent your field of grass as a probability distribution rather than individual objects. However if you still want to see the nice shadows of individual grass strands, you're going to be hard-pressed to make that work real-time as the number of strands grows...
Note that with shadow maps you can use alpha testing (and alpha blending with variance shadow maps), so you can continue to use sprites, although you need to consider how they are going to work from the light's point of view.
Depending on the complexity of your grass, you may want to consider a probabilistic representation, such as Deep Shadow Maps, or variance shadow maps. It might turn out to be easier and better-looking to represent your field of grass as a probability distribution rather than individual objects. However if you still want to see the nice shadows of individual grass strands, you're going to be hard-pressed to make that work real-time as the number of strands grows...
Quote:Original post by Anonymous Poster
Don't use billboards for grass. Create little models, animate them to make them look like they're in a wind. Don't make them turn towards the camera and all your problems will be solved. Then just shadowmap them :)
This is how most games do it these days.
would small models take alot of perofrmance? my demo right now si pretty slow.. but i dont know if its the geometry or the fragment sahder thats taking the performance
Quote:Original post by AndyTX
In such an application, shadow volumes are almost completely out of the questions, so shadow maps are going to be your only option.
Note that with shadow maps you can use alpha testing (and alpha blending with variance shadow maps), so you can continue to use sprites, although you need to consider how they are going to work from the light's point of view.
Depending on the complexity of your grass, you may want to consider a probabilistic representation, such as Deep Shadow Maps, or variance shadow maps. It might turn out to be easier and better-looking to represent your field of grass as a probability distribution rather than individual objects. However if you still want to see the nice shadows of individual grass strands, you're going to be hard-pressed to make that work real-time as the number of strands grows...
as far as ive understood u have to render the sceen 2 times wth shadow mapping... which cuts the performance by half...
ive was thinking for som kind of parallel texture projection using a black version of teh grass being shadeds texture?
Quote:Original post by Anonymous Poster
Don't use billboards for grass. Create little models, animate them to make them look like they're in a wind. Don't make them turn towards the camera and all your problems will be solved. Then just shadowmap them :)
This is how most games do it these days.
Dont animate grass models whatever you do, use a vertex shader to animate, otherwise performance will divebomb.
Otherwise you can do grass in whatever way you want, some games use models, some use sprites, but they key is batching/instancing.
You must use batches and or instancing to do large number of grass. If properly implemented, you can then render it reasonably cheaply, and also you can get away with shadow maps.
In this case, you can use models, or batched sprites (not all sprites have to face the camera, you can make "X" crosses out of two sprites).
Although having each grass model cast its own shadow is going to be costly no matter what. I would reccomemend that each grass recieves sahdows fomr otehr thigs and terrain, but doesnt cast its own sahdow. If it does have to , maybe you can update the shadow map less frequently.
but how do i overcome the problem with the depthmaps resoltuin? a 4096x4096 res wont give very good results since i have a prety large sceen...
Quote:Original post by Dragon_Strike
but how do i overcome the problem with the depthmaps resoltuin? a 4096x4096 res wont give very good results since i have a prety large sceen...
If you're only interested in projection onto a relatively-planar ground, it's actually possible to find a projection matrix that will map pixels perfectly onto a "plane of interest". This will give you ideal resolution on this one plane, so if your ground is "planar enough", you'll be fine.
Otherwise you'll have to split up your shadow map using something Cascaded Shadow Maps, or similar.
You have to realize that wanting shadows of individual grass strands is going to cost quite a bit regardless of how you implement it... there's no silver bullet for light transport - you're always trading off speed and quality of approximation.
for good quality you have to use some form of CSM and only in your nearest shadow map you need to render the grass. The rest you won't see anyway. And up close I render my grass as instanced geometries, and a little bit further I render billboarded patches. You don't see the transition and get the idea the whole field is field with realistic grass geometries. Shadow on and from grass is very expensive because they increase your fillrate with a lot because of the big amount of overdraw .. Might be better to try to fake it with precomputed shadow maps or something which you can tile. This technique works fine for tree shadows in a forest so I presume it must also work for grass patches.
Good luck,
Kenzo
Good luck,
Kenzo
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement