shawn0326 / zen-3d

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

Too hard to add normalScale as in threejs? #29

Closed VanderSP closed 2 years ago

VanderSP commented 2 years ago

Hello there! it´s me again, im working hard on this project... a lot of it already ported... im also testing it in native, not web... im using nativescript in android with canvas alpha... very good software indeed!

Well, in threejs i can make normalmap more "intense" using normalScale... but i know in zen it lacks it...

also... i used to do a hack to resize the normal map... doing this

const normalMapResizer= `vec3 mapN=texture2D( normalMap, v_Uvvec2(0.5,0.5) ).xyz 2.0 - 1.0;

                   mapN.xy *= vec2(4.0,4.0);   <--- this value its just a test... because i used 'normalScale' variable... but there´s no ONBEFORECOMPILE?

                   normal = perturbNormal2Arb( - vViewPosition, normal, mapN, faceDirection );`

material.onBeforeCompile = (shader) => { shader.fragmentShader = shader.fragmentShader.replace( '#include ', normalMapResizer ) }

thanks!

i think i can try to edit the map in photoshop... it´s not very important... i think the unreal bloom would be the greatest addition

VanderSP commented 2 years ago

Just found that pre-resizing in ps gives more control and quality