- Home /
Is it possible to use a different mesh for shadow casting than for normal rendering of an object?
I'd like to use a less detailed mesh to approximate the shadow cast by a highly detailed mesh.
For example a character in the game would use a detailed mesh to render the character and a less detailed mesh to render the character's shadow. This approach would presumably speed up the shadow rendering pass.
I'm actually considering using a similar technique. But I want to use it mostly to break my characters up into solid shadow proxies that are parented to the character's joints. I figure, since skinned objects don't batch, this could allow all the shadow casting objects for the characters to get batched together during the shadow rendering. This would also give me the opportunity to simplify the shadow casters, of course.
Answer by Whimsical · Jul 24, 2010 at 06:51 AM
What I do in such a case is to add a low detail object as shadow proxy to my scenes and assign an alpha cutout shader to it and pull the cutoff value up to full. This makes the shadow proxy object invisible to the camera but is still casting a shadow. Of course, you have to switch off 'receive shadow' on the proxy and 'cast shadow' on your high poly object to make this work the way it should.
Sorry to resurrect this but try as I might I can not get this to work as you describe Whimsical. When I apply a transparent>cutout>diffuse the shadows of the proxy always disappear as the cutoff is ramped up. I need one object to be visible (& not cast shadows) while another is invisible (& casts proxy shadows). Hopefully someone can give me a point in the right direction. Cheers
I also have trouble with this method but would quite like to be able to do this.
Answer by Eric5h5 · Apr 14, 2010 at 11:20 PM
I think there would need to be something like a Camera.OnRenderShadow function for that to work, but unfortunately there isn't. However, the shadows are already rendered without lighting or anything, so it's just polygons, which isn't much of a speedup except on very low-end cards.
I have no experience with dealing with this. However, I must say that I saw this technique being used a LOT on the last generation of consoles. Even the PS2's best-looking series, God of War (including the 720p version on PS3) used extremely blocky geometry for shadows, at least on the main character. So if those guys used it, I'll have to assume it's worth doing sometimes. Then again, the PlayStation 2 is ten years old, so as Eric says, we're probably talking very low-end there.
I really think that you are right with telling us that this will not speed up the shadow rendering process by a lot, but it does a bit. Filling polygons is still work, even though there's no light and anything rather complicated to do for the graphics hardware. But still, it has to fill those polys every frame. I had some high-poly-scenes where using this technique resulted in a 10% decrease of time taken to render each frame.
Your answer
![](https://koobas.hobune.stream/wayback/20220612163759im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
Graphics.DrawMesh receive shadows but not cast? 1 Answer
Why is the CPU usage so high? 1 Answer
Why does my game require so much rendering power? 1 Answer
Directional Light shining on invalid objects 0 Answers
Good Soft Shadows with HDRP 2 Answers