shawn0326 / zen-3d

JavaScript 3D library.
MIT License
196 stars 24 forks source link

Strange thing in LAB OCEAN (not a typo but possible standarization) #11

Closed VanderSP closed 4 years ago

VanderSP commented 4 years ago

Shawn... im crazy or...

renderer.matrixAutoUpdate = false; renderer.lightsAutoupdate = false;

you made a typo? autoU or autou... anyway in the example it seems to work fine right? but if i put this false on this matrix one, my water disappears silently...

misteries!

edit:

haha now i see that

this.worldRenderer.matrixAutoupdate = false this.worldRenderer.lightsAutoUpdate = false

this works

but this no

this.worldRenderer.matrixAutoUpdate = false this.worldRenderer.lightsAutoUpdate = false

so, it´s just a convention not typo, but it can confuse developer, what about streamline it?

edit 2:

okay now im using skybox/water then i want to know a thing...

why everything seems to work OK

even commenting the three lines about environment pass? it´s total useless??

Thanks again, Shawn!

shawn0326 commented 4 years ago

so, it´s just a convention not typo, but it can confuse developer, what about streamline it?

you are right, i will fix this.

why everything seems to work OK, even commenting the three lines about environment pass? it´s total useless??

Which line?I commented the code related to the environment pass, and the demo would‘t work. (ocean will not reflect the sky box)

VanderSP commented 4 years ago

oh i see ok cool!

now, here we go lolol i found how i manage it to work without reflection... was a mess i did... hahaha it works! but i dunno if it´s "Correct", i´ve excluded skybox, and passed the sky directly... maybe it´s more resource hungry instead doing the pass? or just a shorter path?

take a look, run this: (don´t forget to change correct lib paths)

index.zip

a last question...

im confused about setting gamma on camera, and in envmaprender and / or envmaptexture, as i see some examples with and without those things i think i seen some impact on performance in some cases of setting the gamma output, i also notice changes in tonality

last last edit: sorry overloading you with questions... do you know how to apply alphaMap to shaderMaterial? some change onBeforeCompile? i would love to plug a fade on the ocean border.. to smooth the horizon... because in movement this can be very ugly and unexpectedly cause a finite perspective hypnosis!

shawn0326 commented 4 years ago

i´ve excluded skybox, and passed the sky directly... maybe it´s more resource hungry instead doing the pass? or just a shorter path?

Yes, you can do that directly. The only reason to use environmentMapPass in this example is to cache the shader sky to cube texture. (Maybe there is a little performance gain or it can be more convenient to use LOD)

im confused about setting gamma on camera, and in envmaprender and / or envmaptexture, as i see some examples with and without those things

I think it depends entirely on the desired effect and can be omitted. (It also depends on whether some texture resources have been Gamma encoded)

do you know how to apply alphaMap to shaderMaterial? some change onBeforeCompile?

For now, i think the best way is to modify the shaders in Water.js directly.

VanderSP commented 4 years ago

Thanks!