Shadow Mapping has been implemented in SOFA, in order to have a better depth feeling (and an overall nicer scene…) Two versions has been coded :
- hard shadows : quick and not so bad visually,
- soft shadows : requires more GPU processing, but nicer than hard shadows.
|[||caption id=“attachment_1420” align=“alignnone” width=“400”] Soft shadows[/caption]|
(example in examples/Components/visualmodel/OglShadowShader.scn)
First, you have a light in your scene in order to have shadows (obviously). And you will need two more objects :
As you may guess, the important parameter here is softShadows which if true, enable soft shadows, else enable only hard shadows. Put these at the root of your scene file, if you want to cast shadows for all the visual objects in your scene. Finally, press CONTROL + L to draw shadows when simulating. If you don’t want to activate it manually, simply add the parameter shadows to true, which will automatically draws shadows.
Default parameters may be not sufficient for your needs (speed, rendering quality). One important parameter located in Light* object is the texture size, which is used in shadow mapping algorithm.
For hard shadows, greater the number is, more precise the shadow will be, but slower the scene will be … But for soft shadows, greater the number is, fuzzier the shadow will be. So try to have a good balance between speed and rendering quality.
Last modified: 30 September 2019