Opened 5 years ago

Closed 5 years ago

#3226 closed enhancement (fixed)

Make mesh surfaces not cast shadows

Reported by: Tristan Croll Owned by: Tom Goddard
Priority: normal Milestone:
Component: Graphics Version:
Keywords: Cc:
Blocked By: Blocking:
Notify when closed: Platform: all
Project: ChimeraX

Description

The following bug report has been submitted:
Platform:        Linux-3.10.0-1062.9.1.el7.x86_64-x86_64-with-centos-7.7.1908-Core
ChimeraX Version: 1.0 (2020-05-09)
Description
There's something really weird about the interplay between wireframe map contours and "soft" lighting. Compared to transparent or solid surfaces, it darkens the scene *really* dramatically. I've attached a set of images of essentially the same scene with just the map styles changed to illustrate.

OpenGL version: 3.3.0 NVIDIA 440.33.01
OpenGL renderer: TITAN Xp/PCIe/SSE2
OpenGL vendor: NVIDIA Corporation
Manufacturer: Dell Inc.
Model: Precision T5600
OS: CentOS Linux 7 Core
Architecture: 64bit ELF
CPU: 32 Intel(R) Xeon(R) CPU E5-2687W 0 @ 3.10GHz
Cache Size: 20480 KB
Memory:
	              total        used        free      shared  buff/cache   available
	Mem:            62G         10G         18G        335M         33G         51G
	Swap:          4.9G          0B        4.9G

Graphics:
	03:00.0 VGA compatible controller [0300]: NVIDIA Corporation GP102 [TITAN Xp] [10de:1b02] (rev a1)	
	Subsystem: NVIDIA Corporation Device [10de:11df]	
	Kernel driver in use: nvidia
File attachment: soft_lighting_map_issues.tar.gz

soft_lighting_map_issues.tar.gz

Attachments (1)

soft_lighting_map_issues.tar.gz (596.2 KB ) - added by Tristan Croll 5 years ago.
Added by email2trac

Download all attachments as: .zip

Change History (4)

by Tristan Croll, 5 years ago

Added by email2trac

comment:1 by Eric Pettersen, 5 years ago

Component: UnassignedGraphics
Owner: set to Tom Goddard
Platform: all
Project: ChimeraX
Status: newassigned
Summary: ChimeraX bug report submissionwireframe vs. soft lighting

comment:2 by Tom Goddard, 5 years ago

Summary: wireframe vs. soft lightingMake mesh surfaces not cast shadows
Type: defectenhancement

The shadows are behaving as expected. Unfortunately meshes cast shadows. I think they should not cast shadows by default, just as transparent surfaces do not cast shadows by default. The "material" command should allow casting shadows by meshes if desired. I'll make this improvement but not for the 1.0 release because it is too risky. I'll put it in the develop branch so after 1.0 is out the daily builds will have it.

As a work-around for ISOLDE I suggest making the meshes transparent. By default transparent models do not cast shadows. You can make them 99% opaque, any non-zero transparency causes shadows not to be cast. But you should experiment with how much transparency -- in general I find transparent meshes aesthetically much nicer than opaque and you may like 50% transparent or more. Another thing to look out for though is whether transparent meshes slow down rendering. Transparency requires a separate render pass. I would not expect a slow down but needs attention. Soft lighting is extremely expensive, increasing GPU render time by factors from 2 to 20 (estimate) so if render speed is important that lighting should not be used.

Here is an explanation of the current shadow darkening. Transparent surface has no effect on shadowing atoms in soft lighting because it does not cast shadows. But opaque mesh does cast shadows. You might think that the mesh has huge holes and therefore should have minimal darkening effect. That is not the case because of approximations used by ambient lighting. Specifically It uses very coarse shadow maps (2d image of depth value from a given view direction). The pixels of the shadow maps are larger than the holes in the mesh, so the thin mesh lines in fact block all light. This approximation is necessary because we cast shadows from only a very small number of directions (64) and is what achieve needed smoothing so there are not sharp shadow edges criss-crossing everywhere. The reason the atoms look even darker with mesh alone versus mesh + transparent surface is that the transparent surface is adding brightness to the atoms by blending a lighter color with a darker color. These behaviors are not intuitive but consequences of the limitations of the rendering techniques driven by limited performance of graphics hardware.

comment:3 by Tom Goddard, 5 years ago

Resolution: fixed
Status: assignedclosed

Fixed.

Meshes no longer cast shadows (single or ambient) by default. The material command option meshesCastShadows controls this behavior for all models.

Note: See TracTickets for help on using tickets.