Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WebGPURenderer: Iridescence #26489

Merged
merged 8 commits into from
Jul 25, 2023
Merged

WebGPURenderer: Iridescence #26489

merged 8 commits into from
Jul 25, 2023

Conversation

sunag
Copy link
Collaborator

@sunag sunag commented Jul 25, 2023

@sunag sunag marked this pull request as ready for review July 25, 2023 04:05
@sunag sunag added this to the r155 milestone Jul 25, 2023
@sunag sunag merged commit ffd9884 into mrdoob:dev Jul 25, 2023
// Force iridescenceIOR -> outsideIOR when thinFilmThickness -> 0.0
const iridescenceIOR = mix( outsideIOR, eta2, smoothstep( 0.0, 0.03, thinFilmThickness ) );
// Evaluate the cosTheta on the base layer (Snell law)
const sinTheta2Sq = outsideIOR.div( iridescenceIOR ).pow2().mul( float( 1 ).sub( cosTheta1.pow2() ) );
Copy link
Contributor

@LeviPesin LeviPesin Sep 1, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we can use oneMinus here and in similar places below.

const Ess = fab.x.add( fab.y );
const Ems = Ess.oneMinus();

const Favg = specularColor.add( specularColor.oneMinus().mul( 0.047619 ) ); // 1/21
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can't we just write this constant as 1/21 then? It will be converted into its decimal form in any case while building.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants