Opened 12 years ago

Closed 11 years ago

Last modified 11 years ago

#10 closed enhancement (fixed)

Add interactive shadows

Reported by: Tom Goddard Owned by: Tom Goddard
Priority: major Milestone:
Component: Retired Version:
Keywords: Cc:
Blocked By: Blocking:
Notify when closed: Platform: all
Project: chimera

Description

Add interactive shadows.

Might allows shadows cast by a subset of models and onto a subset of models in order to avoid limitations encountered in brain dome video where 500 flying ligands were so spread out compared to the ion channel I wanted to shadow that the texture shadow map was too coarse and gave jagged blocky shadows to ugly to use.

Change History (2)

comment:1 by Tom Goddard, 11 years ago

Resolution: fixed
Status: newclosed

Done.

Current code casts shadows from all models onto all models. A future enhancement could allow only some models to cast or receive shadows.

Current code uses same technique as Chimera 1, drawing a depth texture (shadow map) from the light direction. Only the key light casts shadows. Options of the lighting command control shadows

lighting [shadows true|false] [qualityOfShadows normal|fine|finer|coarse]

Also the "sh" shortcut turns on/off shadows.

comment:2 by Tom Goddard, 11 years ago

A future enhancement is to have rendering of the shadow map not do lighting or coloring calculations in the fragment shader since only depth information is needed. This could make the shadow map calculation pass much faster. But it may not be much faster -- that depends on whether the rasterization is the bottleneck or the actual fragment lighting calculation. The reason I did not simply use a shader that skips lighting and coloring (it is easy to do with current code) is because that would involve a shader switch. The current code caches the most recently used shader program for each drawing. Using two shaders for the same drawing in each frame will defeat the shader cache (requiring vertex array object (VAO) recalculation on every frame) dramatically slowing rendering (10x slower). So a fancier shader cache would be needed to avoid this penalty.

Note: See TracTickets for help on using tickets.