Improve Principled Hair Chiang importance sampling for tilt #114780

Open
opened 2023-11-13 11:00:05 +01:00 by Brecht Van Lommel · 14 comments

The Cycles implementation is based on PBRT.

There was a fix for the importance sampling with tilt, that we should port over:
https://github.com/mmp/pbrt-v3/pull/256

The Cycles implementation is based on PBRT. There was a fix for the importance sampling with tilt, that we should port over: https://github.com/mmp/pbrt-v3/pull/256
Brecht Van Lommel added the
Meta
Good First Issue
Module
Render & Cycles
Type
To Do
labels 2023-11-13 11:00:05 +01:00
Brecht Van Lommel added this to the Render & Cycles project 2023-11-13 11:00:07 +01:00
Contributor

I'd like to give it a shot :)

I'd like to give it a shot :)
Author
Owner

Great, thanks.

Great, thanks.

Not resolved yet?

Not resolved yet?
Contributor

@Kanishk-Tiwari Still on it , I'm waiting for my new PC , the old one fried

@Kanishk-Tiwari Still on it , I'm waiting for my new PC , the old one fried

Hi, @brecht, I am a student, and I also want to make some contribution to cycles in my spare time, there might be some useful algorithms in pbrt-v4 and not implemented in cycles, can I try to implement these algorithms in cycles? I had read some chapters of pbrt-v4 and some cycles codes (e.g. old version principled-bsdf and some light implementation).

Hi, @brecht, I am a student, and I also want to make some contribution to cycles in my spare time, there might be some useful algorithms in pbrt-v4 and not implemented in cycles, can I try to implement these algorithms in cycles? I had read some chapters of pbrt-v4 and some cycles codes (e.g. old version principled-bsdf and some light implementation).
Author
Owner

@liudeyuan the list of things we want to improve in Cycles is in:
https://projects.blender.org/blender/blender/projects/13

Generally we try to go from problem -> solution. If you find a particular algorithm in pbrt-v4 that solves a problem, on the list or not, then you can explain it and we can check if it's a good fit for Cycles.

@liudeyuan the list of things we want to improve in Cycles is in: https://projects.blender.org/blender/blender/projects/13 Generally we try to go from problem -> solution. If you find a particular algorithm in pbrt-v4 that solves a problem, on the list or not, then you can explain it and we can check if it's a good fit for Cycles.

Hi @brecht, is this issue still relevant and if so, can I go ahead and test @HamilcarR 's code with a different kind of fur as mentioned in #115241 ? Likely something that is similar to sheep fur as sheep is already tested.

Hi @brecht, is this issue still relevant and if so, can I go ahead and test @HamilcarR 's code with a different kind of fur as mentioned in #115241 ? Likely something that is similar to sheep fur as sheep is already tested.
Author
Owner

@holly-l it's still relevant, though I'm not sure if @HamilcarR plans to continue work on this.

What I think the main thing to do is test this on an single close up hair strand, and verify that results are correct. It's really hard to tell on a complex hair setup what is right or wrong.

If it's not clear how to verify if it's correct, it's best to pick another Good First Issue. As I can't really explain what to look for without a background in BSDFs and sampling algorithms.

Helpful for testing this mostly:

  • Build with WITH_CYCLES_DEBUG=ON
  • In the preferences, enable "Developer Extras", then in "Experimental" enable Cycles Debug options
  • The in the render properties, there is a Debug panel with options to compare Direct Sampling, Next Event Estimation and MIS.
@holly-l it's still relevant, though I'm not sure if @HamilcarR plans to continue work on this. What I think the main thing to do is test this on an single close up hair strand, and verify that results are correct. It's really hard to tell on a complex hair setup what is right or wrong. If it's not clear how to verify if it's correct, it's best to pick another Good First Issue. As I can't really explain what to look for without a background in BSDFs and sampling algorithms. Helpful for testing this mostly: * Build with `WITH_CYCLES_DEBUG=ON` * In the preferences, enable "Developer Extras", then in "Experimental" enable Cycles Debug options * The in the render properties, there is a Debug panel with options to compare Direct Sampling, Next Event Estimation and MIS.
Contributor

@holly-l it's still relevant, though I'm not sure if @HamilcarR plans to continue work on this.

What I think the main thing to do is test this on an single close up hair strand, and verify that results are correct. It's really hard to tell on a complex hair setup what is right or wrong.

If it's not clear how to verify if it's correct, it's best to pick another Good First Issue. As I can't really explain what to look for without a background in BSDFs and sampling algorithms.

Helpful for testing this mostly:

  • Build with WITH_CYCLES_DEBUG=ON
  • In the preferences, enable "Developer Extras", then in "Experimental" enable Cycles Debug options
  • The in the render properties, there is a Debug panel with options to compare Direct Sampling, Next Event Estimation and MIS.

Hello , Sorry I didn't update this issue earlier .
I had IRL stuff to attend to these last 2 months , came back 3 days ago and I had to finish another issue as I was working on it before this one.
I'm currently fully on this now.
Like you said it's a bit hard on a complex hair model , and the pull request's examples may not be reflective of real changes because I forgot about image compression when comparing the images.
For now , it's really hard to see any meaningful differences between the bugged version and the new one . I think the math is correct in the last commit if I'm not mistaken, but like you said , on complex hair models it's difficult to see differences .
The problem should be more noticeable on a cuticles with a 4° angle ... Right now I'm just making more tests with simpler hair fibers.

> @holly-l it's still relevant, though I'm not sure if @HamilcarR plans to continue work on this. > > What I think the main thing to do is test this on an single close up hair strand, and verify that results are correct. It's really hard to tell on a complex hair setup what is right or wrong. > > If it's not clear how to verify if it's correct, it's best to pick another Good First Issue. As I can't really explain what to look for without a background in BSDFs and sampling algorithms. > > Helpful for testing this mostly: > * Build with `WITH_CYCLES_DEBUG=ON` > * In the preferences, enable "Developer Extras", then in "Experimental" enable Cycles Debug options > * The in the render properties, there is a Debug panel with options to compare Direct Sampling, Next Event Estimation and MIS. > > Hello , Sorry I didn't update this issue earlier . I had IRL stuff to attend to these last 2 months , came back 3 days ago and I had to finish another issue as I was working on it before this one. I'm currently fully on this now. Like you said it's a bit hard on a complex hair model , and the pull request's examples may not be reflective of real changes because I forgot about image compression when comparing the images. For now , it's really hard to see any meaningful differences between the bugged version and the new one . I think the math is correct in the last commit if I'm not mistaken, but like you said , on complex hair models it's difficult to see differences . The problem should be more noticeable on a cuticles with a 4° angle ... Right now I'm just making more tests with simpler hair fibers.

You can explain what to look for. I do have a background in computer graphics from my alma mater.

Amine, are you testing the single strand sheep hair that was mentioned or others as well? I think we should try not to overlap the work being done.

You can explain what to look for. I do have a background in computer graphics from my alma mater. Amine, are you testing the single strand sheep hair that was mentioned or others as well? I think we should try not to overlap the work being done.
Contributor

You can explain what to look for. I do have a background in computer graphics from my alma mater.

Amine, are you testing the single strand sheep hair that was mentioned or others as well? I think we should try not to overlap the work being done.

Yes , I'm working with a bunch of hair types , but you can check the one you want , no worries.

I think it all boils down to a difference in specular reflection in the hair. the longitudinal scattering gives you the specular reflection of light along the hair fiber.
since this is what being modified , we should at least expect a difference in the size of the highlight , at a high cuticle angle , between the old code , and the new one.
For now , my tests have been the same between the two at low angle, the only difference between the two images is just the sampling's noise.
Also , I will edit my pull request about this , but the images diffs I posted are not actual differences , I made the stupid mistake of saving the images in jpeg , and what you see is probably due to compression.
right now like I said , there's no real differences except white noise (at low angle)

> You can explain what to look for. I do have a background in computer graphics from my alma mater. > > Amine, are you testing the single strand sheep hair that was mentioned or others as well? I think we should try not to overlap the work being done. > Yes , I'm working with a bunch of hair types , but you can check the one you want , no worries. I think it all boils down to a difference in specular reflection in the hair. the longitudinal scattering gives you the specular reflection of light along the hair fiber. since this is what being modified , we should at least expect a difference in the size of the highlight , at a high cuticle angle , between the old code , and the new one. For now , my tests have been the same between the two at low angle, the only difference between the two images is just the sampling's noise. Also , I will edit my pull request about this , but the images diffs I posted are not actual differences , I made the stupid mistake of saving the images in jpeg , and what you see is probably due to compression. right now like I said , there's no real differences except white noise (at low angle)
Contributor

so , I'm finally starting to get a bit of results from the new version :

old render new render specular difference
chiang_old chiang_new image image

the old code seems to exhibit areas of hair that have a specular effect that is "darker" in the direction of light

so , I'm finally starting to get a bit of results from the new version : |old render | new render| specular| difference | |-----------------|-------------------|----------------|--------------| |![chiang_old](/attachments/688d0d9b-1dad-49b3-939a-abb0a1b64383)| ![chiang_new](/attachments/61c8d3bd-5d55-4bdd-a24a-9efd7bebe851)| ![image](/attachments/a000cfe5-626e-4731-b648-6e6de8a4f5f0) | ![image](/attachments/70aedbb8-2508-4762-bb44-ae27ab0d48f2) | the old code seems to exhibit areas of hair that have a specular effect that is "darker" in the direction of light
Author
Owner

It looks visually pleasing.Though a single hair render with simple light setup would still help understand if it's correct.

It looks visually pleasing.Though a single hair render with simple light setup would still help understand if it's correct.
Contributor

little update : Those are single fibers samples , there's definitely a better specular highlight

old new diff
chiang_old_300s.bmp chiang_new_300s.bmp chiang_diff.bmp
little update : Those are single fibers samples , there's definitely a better specular highlight |old|new|diff| |----|-------|-------| |![chiang_old_300s.bmp](/attachments/616bcd44-02d4-4103-9d9f-3f514a619787)|![chiang_new_300s.bmp](/attachments/5065ea7a-007b-41b0-af8d-82dbc6ea3518)|![chiang_diff.bmp](/attachments/e2916a04-9660-4706-bde9-3a5555337237)|
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 Assignees
5 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#114780
No description provided.