BI: Transparent shadows fail under certain circumstances #39981

Closed
opened 2014-05-01 15:10:20 +02:00 by Willi · 14 comments

System Information
Win7/64, AMD HD 6850

Blender Version
at least since 2.63a, including latest build

Short description of error
Under certain circumstances, transparent shadows are black even though "Receive transparent" is enabled.

Exact steps for others to reproduce the error
Open the attached file. Description:

  • Floor: is to receive transparent shadows. Uses node material "Floor node" which again uses material "Floor"
  • Glass above the floor: Uses node material "Glass node" which again uses material "Glass" (with alpha=0.2)
  • Lamp above the glass

Render the scene. The problem is: The shadow on the floor is completely black even though the glass above has alpha=0.2 and the floor has "receive transparent" enabled.

After a long journey, I found out that, if the floor uses a node material AND the glass uses a node material, not the alpha value of material "glass" that is used in the node setup of "glass node" is used for shadow transparency. Instead, the alpha value of the node material "Glass node" itself is used. However, the latter is not visible in the UI if the material is a node material. Therefore, you have to

  • Disable "use nodes" for "Glass node". This reveals the alpha value for "Glass node" itself. This value seems to be responsible for the shadow transparency.
  • Turn the value down to e.g. 0.2,

Enable "use nodes".

Render again and the problem is "solved", i.e. the shadow is not completely black anymore. This can only be considered a workaround because one manually has to keep the alpha values of "Glass" and "Glass node" (which is only visible when temporarily disabling "use nodes") in sync.

In addition: This all is only true if the floor uses a node material, too. So, starting with my orignal test file again, select the floor and assign material "Floor", which is not a node material. Render again. Now, transparent shadows work even though the glass uses a node material and it's hidden alpha value is 1.

Maybe complicated to explain, but I don't think that this is a very rare setup.

Thanks!

TransparentShadows.blend

**System Information** Win7/64, AMD HD 6850 **Blender Version** at least since 2.63a, including latest build **Short description of error** Under certain circumstances, transparent shadows are black even though "Receive transparent" is enabled. **Exact steps for others to reproduce the error** Open the attached file. Description: - Floor: is to receive transparent shadows. Uses node material "Floor node" which again uses material "Floor" - Glass above the floor: Uses node material "Glass node" which again uses material "Glass" (with alpha=0.2) - Lamp above the glass Render the scene. The problem is: The shadow on the floor is completely black even though the glass above has alpha=0.2 and the floor has "receive transparent" enabled. After a long journey, I found out that, if the floor uses a node material AND the glass uses a node material, not the alpha value of material "glass" that is used in the node setup of "glass node" is used for shadow transparency. Instead, the alpha value of the node material "Glass node" itself is used. However, the latter is not visible in the UI if the material is a node material. Therefore, you have to - Disable "use nodes" for "Glass node". This reveals the alpha value for "Glass node" itself. This value seems to be responsible for the shadow transparency. - Turn the value down to e.g. 0.2, # Enable "use nodes". Render again and the problem is "solved", i.e. the shadow is not completely black anymore. This can only be considered a workaround because one manually has to keep the alpha values of "Glass" and "Glass node" (which is only visible when temporarily disabling "use nodes") in sync. In addition: This all is only true if the floor uses a node material, too. So, starting with my orignal test file again, select the floor and assign material "Floor", which is not a node material. Render again. Now, transparent shadows work even though the glass uses a node material and it's hidden alpha value is 1. Maybe complicated to explain, but I don't think that this is a very rare setup. Thanks! [TransparentShadows.blend](https://archive.blender.org/developer/F86543/TransparentShadows.blend)
Author

Changed status to: 'Open'

Changed status to: 'Open'
Author

Added subscriber: @willi-2

Added subscriber: @willi-2

Added subscriber: @mont29

Added subscriber: @mont29
Author

Addition: Same problem with Transparency -> Filter property.
I always have to disable nodes, change the property value, enable nodes.
Probably applies to other properties as well.

Addition: Same problem with Transparency -> Filter property. I always have to disable nodes, change the property value, enable nodes. Probably applies to other properties as well.
Brecht Van Lommel was assigned by Sergey Sharybin 2014-05-19 10:26:09 +02:00

Added subscribers: @brecht, @Sergey

Added subscribers: @brecht, @Sergey

@brecht, would you mind having a look into this report? Thanks! :)

@brecht, would you mind having a look into this report? Thanks! :)
Member

Added subscriber: @IRIEShinsuke

Added subscriber: @IRIEShinsuke
Member

This is caused by "if(shi->nodes==0 &&" in rayshade.c L.544, which has been added in order to prevent infinite recursion.
Removing it resolves the issue though I'm not sure if it's still needed.

This is caused by "if(shi->nodes==0 &&" in rayshade.c L.544, which has been added in order to prevent infinite recursion. Removing it resolves the issue though I'm not sure if it's still needed.

The check was added to fix #18801 (Rendering Down with RC3.).

Removing shi->nodes == 0 && in the current code still makes the file TestGTR.zip from that bug report crash, so a better solution is needed.

The check was added to fix #18801 (Rendering Down with RC3.). Removing `shi->nodes == 0 &&` in the current code still makes the file [TestGTR.zip](https://archive.blender.org/developer/F9769/TestGTR.zip) from that bug report crash, so a better solution is needed.
Brecht Van Lommel removed their assignment 2014-05-23 15:43:49 +02:00

The original fix was not really addressing the issue as hinted in the bug report. 33304d022d

Perhaps a solution is to have some way to indicate when the material is being evaluated for shadow transparency, and in that case to skip tracing reflection or refraction rays.

Shadow transparency for Blender Internal node materials is fundamentally broken though. That's really a different quantity than the "combined" RGBA result that you can output now in a node setup. The amount of light that shines on a surface should never influence the shadow transparency color of a surface, but it does now. So the code can be tweaked a bit to avoid the recursion problem but there is no correct solution besides a bigger redesign.

The original fix was not really addressing the issue as hinted in the bug report. 33304d022d Perhaps a solution is to have some way to indicate when the material is being evaluated for shadow transparency, and in that case to skip tracing reflection or refraction rays. Shadow transparency for Blender Internal node materials is fundamentally broken though. That's really a different quantity than the "combined" RGBA result that you can output now in a node setup. The amount of light that shines on a surface should never influence the shadow transparency color of a surface, but it does now. So the code can be tweaked a bit to avoid the recursion problem but there is no correct solution besides a bigger redesign.
Member

Er, maybe @brecht misunderstands the current behavior of the transparent shadow... The shadow color always becomes black (not the "combined" color!) because the shader output node doesn't set shr->diff. (I've already noticed this strange behavior several months ago and plan to fix it.)

I think, to obtain correctly colored transparent shadows, the material node and the output node need additional sockets like "Shadeless Color" output and "Transmission Color" input, respectively.

Er, maybe @brecht misunderstands the current behavior of the transparent shadow... The shadow color always becomes black (not the "combined" color!) because the shader output node doesn't set shr->diff. (I've already noticed this strange behavior several months ago and plan to fix it.) I think, to obtain correctly colored transparent shadows, the material node and the output node need additional sockets like "Shadeless Color" output and "Transmission Color" input, respectively.
Sergey Sharybin self-assigned this 2014-07-21 17:37:15 +02:00

@IRIEShinsuke, perhaps you're talking about the different issue. In this particular report issue is caused by the shade_ray() forced to sue shade_color() instead of material node evaluation for the transparent shadow ray. This makes it use alpha setting from the material itself, not the nodes. Workaround would be to disable nodes, set material Alpha to 0.2 and enable nodes again.

@brecht, it might work, yes bit it's a bit of a work. Meanwhile i can think of such modification of the original workaround http://www.pasteall.org/54087/diff Any thoughts?

@IRIEShinsuke, perhaps you're talking about the different issue. In this particular report issue is caused by the `shade_ray()` forced to sue `shade_color()` instead of material node evaluation for the transparent shadow ray. This makes it use alpha setting from the material itself, not the nodes. Workaround would be to disable nodes, set material Alpha to 0.2 and enable nodes again. @brecht, it might work, yes bit it's a bit of a work. Meanwhile i can think of such modification of the original workaround http://www.pasteall.org/54087/diff Any thoughts?

Changed status from 'Open' to: 'Archived'

Changed status from 'Open' to: 'Archived'

Well, not strictly speaking a bug, just raycasting is not a friend to a node trees. Will solve as a part of TODO process http://wiki.blender.org/index.php/Dev:2.5/Source/Development/Todo/Render#Render_Engine

Thanks for the report anyway.

Well, not strictly speaking a bug, just raycasting is not a friend to a node trees. Will solve as a part of TODO process http://wiki.blender.org/index.php/Dev:2.5/Source/Development/Todo/Render#Render_Engine Thanks for the report anyway.
Sign in to join this conversation.
5 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: blender/blender#39981
No description provided.