Improve emission encoding
This commit is contained in:
parent
36a4737be6
commit
b19dd57c5b
|
@ -31,7 +31,7 @@ vec4 traceDiffuseVoxelCone(const vec3 from, vec3 direction) {
|
|||
float ll = (level + 1.0) * (level + 1.0);
|
||||
vec4 voxel = textureLod(voxels, c, min(MAX_MIPMAP, level));
|
||||
#ifdef _Cycles
|
||||
voxel.rgb *= 10.0; // Higher range to allow emission
|
||||
voxel.rgb = min(voxel.rgb * 0.9, vec3(0.9)) + max((voxel.rgb - 0.9) * 200.0, 0.0); // Higher range to allow emission
|
||||
#endif
|
||||
acc += 0.075 * ll * voxel * pow(1.0 - voxel.a, 2.0);
|
||||
dist += ll * VOXEL_SIZE * 2.0;
|
||||
|
|
|
@ -194,7 +194,7 @@ def parse_shader(node, socket):
|
|||
parsing_basecolor(False)
|
||||
if node.inputs[9].is_linked or node.inputs[9].default_value != 1.0:
|
||||
out_emission = '({0} * {1})'.format(out_emission, parse_value_input(node.inputs[9]))
|
||||
out_basecol = '({0} + {1} * 10.0)'.format(out_basecol, out_emission)
|
||||
out_basecol = '({0} + {1} * 100.0)'.format(out_basecol, out_emission)
|
||||
|
||||
if parse_opacity:
|
||||
out_opacity = parse_value_input(node.inputs[12])
|
||||
|
@ -300,7 +300,7 @@ def parse_shader(node, socket):
|
|||
parsing_basecolor(False)
|
||||
emission_found = True
|
||||
strength = parse_value_input(node.inputs[1])
|
||||
out_basecol = '({0} * ({1} * 10.0))'.format(out_basecol, strength)
|
||||
out_basecol = '({0} * ({1} * 100.0))'.format(out_basecol, strength)
|
||||
|
||||
elif node.type == 'BSDF_GLASS':
|
||||
if parse_surface:
|
||||
|
|
|
@ -115,14 +115,15 @@ def make(context_id):
|
|||
geom.write('}')
|
||||
geom.write('EndPrimitive();')
|
||||
|
||||
if wrd.lighting_model == 'Cycles':
|
||||
frag.write('basecol /= 10.0;') # Higher range to allow emission
|
||||
|
||||
if cycles.emission_found:
|
||||
frag.write('vec3 color = basecol;')
|
||||
else:
|
||||
frag.write('vec3 color = basecol * visibility * lightColor * dotNL * attenuate(distance(wposition * voxelgiDimensions.x, lightPos));')
|
||||
frag.write('vec3 voxel = wposition * 0.5 + vec3(0.5);')
|
||||
|
||||
if wrd.lighting_model == 'Cycles':
|
||||
frag.write('color = min(color * 0.9, vec3(0.9)) + min(color / 200.0, 0.1);') # Higher range to allow emission
|
||||
|
||||
frag.write('imageStore(voxels, ivec3(voxelgiResolution * voxel), vec4(color, 1.0));')
|
||||
|
||||
return con_voxel
|
||||
|
|
Loading…
Reference in a new issue