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

SkyMesh: Rename up property to avoid name collision #29199

Merged
merged 1 commit into from
Aug 21, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions examples/jsm/objects/SkyMesh.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ class SkyMesh extends Mesh {
this.mieCoefficient = uniform( 0.005 );
this.mieDirectionalG = uniform( 0.8 );
this.sunPosition = uniform( new Vector3() );
this.up = uniform( new Vector3( 0, 1, 0 ) );
this.upUniform = uniform( new Vector3( 0, 1, 0 ) );

this.isSky = true;

Expand Down Expand Up @@ -70,7 +70,7 @@ class SkyMesh extends Mesh {

// varying sun intensity

const angle = dot( vSunDirection, this.up );
const angle = dot( vSunDirection, this.upUniform );
const zenithAngleCos = clamp( angle, - 1, 1 );
const sunIntensity = EE.mul( max( 0.0, float( 1.0 ).sub( pow( e, cutoffAngle.sub( acos( zenithAngleCos ) ).div( steepness ).negate() ) ) ) );
varyingProperty( 'float', 'vSunE' ).assign( sunIntensity );
Expand Down Expand Up @@ -132,7 +132,7 @@ class SkyMesh extends Mesh {

// optical length
// cutoff angle at 90 to avoid singularity in next formula.
const zenithAngle = acos( max( 0.0, dot( this.up, direction ) ) );
const zenithAngle = acos( max( 0.0, dot( this.upUniform, direction ) ) );
const inverse = float( 1.0 ).div( cos( zenithAngle ).add( float( 0.15 ).mul( pow( float( 93.885 ).sub( zenithAngle.mul( 180.0 ).div( pi ) ), - 1.253 ) ) ) );
const sR = rayleighZenithLength.mul( inverse );
const sM = mieZenithLength.mul( inverse );
Expand All @@ -157,7 +157,7 @@ class SkyMesh extends Mesh {
const betaMTheta = vBetaM.mul( mPhase );

const Lin = pow( vSunE.mul( add( betaRTheta, betaMTheta ).div( add( vBetaR, vBetaM ) ) ).mul( sub( 1.0, Fex ) ), vec3( 1.5 ) );
Lin.mulAssign( mix( vec3( 1.0 ), pow( vSunE.mul( add( betaRTheta, betaMTheta ).div( add( vBetaR, vBetaM ) ) ).mul( Fex ), vec3( 1.0 / 2.0 ) ), clamp( pow( sub( 1.0, dot( this.up, vSunDirection ) ), 5.0 ), 0.0, 1.0 ) ) );
Lin.mulAssign( mix( vec3( 1.0 ), pow( vSunE.mul( add( betaRTheta, betaMTheta ).div( add( vBetaR, vBetaM ) ) ).mul( Fex ), vec3( 1.0 / 2.0 ) ), clamp( pow( sub( 1.0, dot( this.upUniform, vSunDirection ) ), 5.0 ), 0.0, 1.0 ) ) );

// nightsky

Expand Down