SSS direct/indirect turns out black in texture bake #40060

Closed
opened 2014-05-07 02:05:47 +02:00 by Daniel Salazar · 13 comments
Member

System Information

openSUSE 12.3 64bits
NVIDIA 480GTX SC

Blender Version

Broken: f300c15

Short description of error

Baking SSS Color works fine but Direct, Indirect or Combined results in black color

Exact steps for others to reproduce the error

SSSBake.blend

**System Information** openSUSE 12.3 64bits NVIDIA 480GTX SC **Blender Version** Broken: f300c15 **Short description of error** Baking SSS Color works fine but Direct, Indirect or Combined results in black color **Exact steps for others to reproduce the error** [SSSBake.blend](https://archive.blender.org/developer/F87394/SSSBake.blend)
Author
Member

Changed status to: 'Open'

Changed status to: 'Open'
Dalai Felinto was assigned by Daniel Salazar 2014-05-07 02:05:47 +02:00
Author
Member

Added subscriber: @zanqdo

Added subscriber: @zanqdo

The patch above - D503 - seems to work for your file. At least for SSS Color and SSS Direct:
sss.jpg

Top Left: rendered passes (SSS Direct), bottom left: baked SSS Direct; Right: baked SSS shown in the UI

The patch above - [D503](https://archive.blender.org/developer/D503) - seems to work for your file. At least for SSS Color and SSS Direct: ![sss.jpg](https://archive.blender.org/developer/F87400/sss.jpg) Top Left: rendered passes (SSS Direct), bottom left: baked SSS Direct; Right: baked SSS shown in the UI

I tried the patch with a more complex object (caterpillar from Gooseberry) and I got a good result for color, but a very strange result for SSS direct (image layout same as above):

Catterpilar SSS Color: sss_caterpillar_color.jpg
Catterpilar SSS Direct: sss_caterpillar_direct.jpg

I tried the patch with a more complex object (caterpillar from Gooseberry) and I got a good result for color, but a very strange result for SSS direct (image layout same as above): Catterpilar SSS Color: ![sss_caterpillar_color.jpg](https://archive.blender.org/developer/F87407/sss_caterpillar_color.jpg) Catterpilar SSS Direct: ![sss_caterpillar_direct.jpg](https://archive.blender.org/developer/F87409/sss_caterpillar_direct.jpg)

Added subscriber: @brecht

Added subscriber: @brecht

I think the problem in that file is with the bump mapping, which fails due to missing ray differentials (sd.dP).

A quick way to solve that would be to add this after shader_setup_from_sample:

sd.dP.dx = sd.dPdu;
sd.dP.dy = sd.dPdv;

That's not quite right, really this should take the UV map used for baking and the image resolution into account, for that you could look at bake_set_vlr_dxyco in Blender Internal if you want, to see how you can get those differentials from a UV map. Getting that right would mainly help for OSL image texture lookups and advanced procedural textures that do antialiasing.

I think the problem in that file is with the bump mapping, which fails due to missing ray differentials (`sd.dP`). A quick way to solve that would be to add this after `shader_setup_from_sample`: ``` sd.dP.dx = sd.dPdu; sd.dP.dy = sd.dPdv; ``` That's not quite right, really this should take the UV map used for baking and the image resolution into account, for that you could look at `bake_set_vlr_dxyco` in Blender Internal if you want, to see how you can get those differentials from a UV map. Getting that right would mainly help for OSL image texture lookups and advanced procedural textures that do antialiasing.

Hi Brecht, with the latest changes to D503 the baking seems correct (SSS Direct):
sss-caterpillar-direct.jpg

So I'm not sure what did you mean by the bump maps (this file has no node connected to the Displace Input). There is a different issue where materials with a node connected to the Displacement input would fail to bake. I'll see if your suggestion fix that, and if so I will report it separately (or ask someone to do it, with real files ;) and post a patch ... Anyways, I shouldn't drag the other issue in here ;)

Hi Brecht, with the latest changes to [D503](https://archive.blender.org/developer/D503) the baking seems correct (SSS Direct): ![sss-caterpillar-direct.jpg](https://archive.blender.org/developer/F87566/sss-caterpillar-direct.jpg) So I'm not sure what did you mean by the bump maps (this file has no node connected to the Displace Input). There is a different issue where materials with a node connected to the Displacement input would fail to bake. I'll see if your suggestion fix that, and if so I will report it separately (or ask someone to do it, with real files ;) and post a patch ... Anyways, I shouldn't drag the other issue in here ;)

This file is using a bump node to set the normal for SSS, and it seems to cause issues with SSS indirect.

But yes, this should fix the displacement input as well since that uses the same mechanism and ray differentials as the bump node.

This file is using a bump node to set the normal for SSS, and it seems to cause issues with SSS indirect. But yes, this should fix the displacement input as well since that uses the same mechanism and ray differentials as the bump node.

This issue was referenced by blender/blender-addons-contrib@83cdd5887f

This issue was referenced by blender/blender-addons-contrib@83cdd5887f10e1998a434fb1632e0b76ec938d91

This issue was referenced by 83cdd5887f

This issue was referenced by 83cdd5887f10e1998a434fb1632e0b76ec938d91

Changed status from 'Open' to: 'Resolved'

Changed status from 'Open' to: 'Resolved'

Closed by commit 83cdd5887f.

Closed by commit 83cdd5887f.

Ah ok, I haven't tried SSS indirect. I tried your suggestion (sd.dP.dx, sd.dP.dy) and it works for displacement in the sense that it doesn't produce black. However it seems to simply bypass the displacement. I reported it here #40068 so we can discuss it there.

Ah ok, I haven't tried SSS indirect. I tried your suggestion (sd.dP.dx, sd.dP.dy) and it works for displacement in the sense that it doesn't produce black. However it seems to simply bypass the displacement. I reported it here #40068 so we can discuss it there.
Sign in to join this conversation.
No Label
Interest
Alembic
Interest
Animation & Rigging
Interest
Asset Browser
Interest
Asset Browser Project Overview
Interest
Audio
Interest
Automated Testing
Interest
Blender Asset Bundle
Interest
BlendFile
Interest
Collada
Interest
Compatibility
Interest
Compositing
Interest
Core
Interest
Cycles
Interest
Dependency Graph
Interest
Development Management
Interest
EEVEE
Interest
EEVEE & Viewport
Interest
Freestyle
Interest
Geometry Nodes
Interest
Grease Pencil
Interest
ID Management
Interest
Images & Movies
Interest
Import Export
Interest
Line Art
Interest
Masking
Interest
Metal
Interest
Modeling
Interest
Modifiers
Interest
Motion Tracking
Interest
Nodes & Physics
Interest
OpenGL
Interest
Overlay
Interest
Overrides
Interest
Performance
Interest
Physics
Interest
Pipeline, Assets & IO
Interest
Platforms, Builds & Tests
Interest
Python API
Interest
Render & Cycles
Interest
Render Pipeline
Interest
Sculpt, Paint & Texture
Interest
Text Editor
Interest
Translations
Interest
Triaging
Interest
Undo
Interest
USD
Interest
User Interface
Interest
UV Editing
Interest
VFX & Video
Interest
Video Sequencer
Interest
Virtual Reality
Interest
Vulkan
Interest
Wayland
Interest
Workbench
Interest: X11
Legacy
Blender 2.8 Project
Legacy
Milestone 1: Basic, Local Asset Browser
Legacy
OpenGL Error
Meta
Good First Issue
Meta
Papercut
Meta
Retrospective
Meta
Security
Module
Animation & Rigging
Module
Core
Module
Development Management
Module
EEVEE & Viewport
Module
Grease Pencil
Module
Modeling
Module
Nodes & Physics
Module
Pipeline, Assets & IO
Module
Platforms, Builds & Tests
Module
Python API
Module
Render & Cycles
Module
Sculpt, Paint & Texture
Module
Triaging
Module
User Interface
Module
VFX & Video
Platform
FreeBSD
Platform
Linux
Platform
macOS
Platform
Windows
Priority
High
Priority
Low
Priority
Normal
Priority
Unbreak Now!
Status
Archived
Status
Confirmed
Status
Duplicate
Status
Needs Info from Developers
Status
Needs Information from User
Status
Needs Triage
Status
Resolved
Type
Bug
Type
Design
Type
Known Issue
Type
Patch
Type
Report
Type
To Do
No Milestone
No project
No Assignees
4 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: blender/blender#40060
No description provided.