Marcin Ignac

Results 285 comments of Marcin Ignac

> are you going to be be able to change these on the fly? Same as currently recompilation happens when any of the material parameters modifying shader is changed. >...

@dmnsgn which part of it is vague? If code then then way Scene Kit defines it is very clear: "after the above values are defined/read but before they are used....

Code injection points geometry: [material.vert.js#L134](https://github.com/pex-gl/pex-renderer/blob/master/shaders/pipeline/material.vert.js#L134) and [depth-pass.vert.js#L124 ](https://github.com/pex-gl/pex-renderer/blob/master/shaders/pipeline/depth-pass.vert.js#L124) surface: [material.frag.js#L203](https://github.com/pex-gl/pex-renderer/blob/master/shaders/pipeline/material.frag.js#L203) fragment: [material.frag.js#L253](https://github.com/pex-gl/pex-renderer/blob/master/shaders/pipeline/material.frag.js#L253)

Yes, it's limiting but also make things clear how they work and provides immunity from underlying shader code changes. Otherwise things get complicated fast just to cover remaining 5-10% of...

Another good thing i see coming out of it we could clean up code a bit as now values are defined and computed all over the place at different stages....

A good idea is to write a list of use cases: Easy - tri planar texture mapping -> surface - generative colors (base color, metallic) -> surface - toon shading...

@dmnsgn to answer your earlier question about uniforms and varying. Similar to what thi.ng/umbrella is doing we could move to more modular shader definitions like here : https://github.com/thi-ng/umbrella/blob/master/examples/webgl-ssao/src/shaders.ts#L20 ![Group 21](https://user-images.githubusercontent.com/171001/65871457-5b5d5480-e376-11e9-9f00-e68473216697.png)...

For now this is what's happening Renderer following shader chunks ``` this.shaders = { chunks: SHADERS_CHUNKS, pipeline: { material: { vert: PBR_VERT, frag: PBR_FRAG } } } ``` We customize...

Proper syntax with `elif defined` ```javascript var frag = `#ifdef DEPTH_PRE_PASS_ONLY ${renderer.shaders.pipeline.depthPrePass.frag} #elif defined DEPTH_PASS_ONLY ${renderer.shaders.pipeline.depthPass.frag} #else ${renderer.shaders.pipeline.material.frag.replace( `gl_FragData[0] = encode(vec4(color, 1.0), uOutputEncoding);`, `color = data.normalView * 0.5 + 0.5;...

Note to self: If above ifelse doesn't work try ```glsl #ifdef DEPTH_PRE_PASS_ONLY //copy pre pass shader #endif #ifdef DEPTH_PASS_ONLY //copy depth shader #endif #ifndef DEPTH_PRE_PASS_ONLY #ifndef DEPTH_PASS_ONLY //pbr shader #endif...