WIP: Fix #114780: Cycles: Importance sampling correction #115241
No reviewers
Labels
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
3 Participants
Notifications
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: blender/blender#115241
Loading…
Reference in New Issue
No description provided.
Delete Branch "HamilcarR/blender:cycles-114780_chiang-hair"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Principled Chiang hair longitudinal importance sampling correction,
according to the new pbrt fix here :
https://github.com/mmp/pbrt-v3/pull/256 ,
for issue : #114780.
Edit : Fix inverted scale tilt
WIP:Cycles: Fix #114780 : Importance sampling correctionto WIP: Fix #114780: Cycles: Importance sampling correctionThe Old image has the compositor enabled while the Corrected one does not.
Ah it's true . sorry , I don't know what results to expect yet , it's the first time I work with BSDFs . Still working on it , but I think the second image is not valid ... when changing alpha values to 0 , I don't see any difference with the second image...
Should expect the hair to be more "glossy" like , since light doesn't scatter as much , I guess ?
There is a difference.
The fix seems to reduce color noise, improve noise for certain sections, as well as adding a bit of specularity to some areas (especially the bottom part of the image).
40sample old
can you pinpoint the differences on the image if that doesn't bother you ?
For example , I can see that there's a difference in colors , this is your version :
And the one I "corrected" :
I'm no 3D artist , but I can see mine has some kind of a greyish look... while yours has more pronounced colors .
I also cannot find the difference in specularity
Reduced color noise:
Enhanced specularity (cattle is not the best example to show cuticle tilt, sheep would most likely be better, or you could try increasing the tilt to something like 25 to see if large tilts highlight the difference), this little clump of hair and the loose children around it are brighter, indicating either enhanced or different specularity (in this specific section, the secondary reflection seems to benefit the most):
Edit, We could probably get a control reference between old and new by setting tilt to 0, since that code only(?) handles tilt.
I now see the difference for the noise , but for the specularity , not at all , is it that subtle on this kind of fur ?
Edit : Also , I think the noise reduction is due to the jpeg compression algorithm , need more tests
How did you make the
difference
image? Using the images you provide I get thisAlso, could you send me/link me the build.
Hi , I just used the compositor :
can you tell me how to do this ? one of the
makefile
file ?Edit : rendered the two bases images into .hdr files , and made another diff , I think the compression messed up my other renders when I saved them into png or jpeg...
that line at the top , on the other hand is troublesome...
21ee5c8859
toea85357491
WIP: Fix #114780: Cycles: Importance sampling correctionto Fix #114780: Cycles: Importance sampling correctionThank you! Sorry for the delay, somehow this PR totally slipped my attention.
The implementation looks mostly correct, however, it totally negated the behaviour of scale tilt, that's not what we want. You should add
bsdf->alpha = -bsdf->alpha;
inbsdf_hair_chiang_setup()
(alternatively, preserve the +/- signs inhair_alpha_angles()
), fix another issue I mentioned about the residual component, and update the reference images you posted in the PR. Then we can have a look how much this PR improves.@ -225,8 +227,8 @@ ccl_device_inline void hair_attenuation(
}
/* Given the tilt angle, generate the rotated theta_i for the different bounces. */
also change
theta_i
totheta_o
in the comment.BTW the comment is quite misleading, considering it's not generating angles but sin_angles and cos_angles.
I would prefer rewriting it as:
/* Update sin_theta_o and cos_theta_o to account for scale tilt in each bounces. */
@ -349,2 +351,3 @@
const float3 local_O = make_float3(dot(sd->wi, X), dot(sd->wi, Y), dot(sd->wi, Z));
const float3 local_O = make_float3(
dot(sd->wi, X), dot(sd->wi, Y), dot(sd->wi, Z)); /* wo in pbrt */
Put this comment above the code, add a period at the end of sentence
@ -394,3 +393,1 @@
float cos_theta_i = cos_from_sin(sin_theta_i);
float angles[6];
float angles[6]; /* contains sinThetaOp and cosThetaOp for each ray bounce */
This comment does not explain what
sinThetaOp
andcosThetaOp
are. Maybe:/* Updated sin_theta_o and cos_theta_o accounting for scale tilt in each bounce. */
Remember to use proper English sentence, starting with a captical letter and ending with a full-stop: https://developer.blender.org/docs/handbook/guidelines/c_cpp/#comments
I would also prefer putting this comment above the variable.
@ -398,3 +398,1 @@
hair_alpha_angles(sin_theta_i, cos_theta_i, -bsdf->alpha, angles);
sin_theta_i = angles[2 * p];
cos_theta_i = angles[2 * p + 1];
sintheta_temp_o = angles[2 * p];
I do not like this naming, because this variable has a concrete meaning and is therefore not temp, and it does not following the naming convention of the nearby code.
I suggest
sin_theta_o_tilted
agreed , this was poorly named.
@ -433,3 +435,3 @@
{
const float Mp = longitudinal_scattering(
sin_theta_i, cos_theta_i, sin_theta_o, cos_theta_o, 4.0f * bsdf->v);
sin_theta_i, cos_theta_i, sintheta_temp_o, costheta_temp_o, 4.0f * bsdf->v);
In
eval()
we don't consider scale tilt for the residual component, we shouldn't change this behaviour here.Fix #114780: Cycles: Importance sampling correctionto WIP: Fix #114780: Cycles: Importance sampling correctionThank you for your feedback.
I'm sorry myself for the delay , tough two last months at work.
there's just one question , concerning the residual component , from my understanding , this is the last "ray" coming out of the hair, but why isn't scale tilt applied at this level ?
The residual term accumulates all the contribution after TRT, and is assumed to be diffuse, so the tilt doesn't make a difference.
Checkout
From your project repository, check out a new branch and test the changes.