Cleanup
This commit is contained in:
parent
6d37095014
commit
ccc427c04a
|
@ -60,7 +60,7 @@ float random(vec2 coords) {
|
|||
|
||||
vec3 nishita_lookupLUT(const float height, const float sunTheta) {
|
||||
vec2 coords = vec2(
|
||||
sqrt(height * (1 / nishita_atmo_radius)),
|
||||
sqrt(height * (1 / nishita_atmo_radius)),
|
||||
0.5 + 0.5 * sign(sunTheta - HALF_PI) * sqrt(abs(sunTheta * (1 / HALF_PI) - 1))
|
||||
);
|
||||
return textureLod(nishitaLUT, coords, 0.0).rgb;
|
||||
|
@ -125,7 +125,7 @@ vec3 nishita_atmosphere(const vec3 r, const vec3 r0, const vec3 pSun, const floa
|
|||
// Idea behind this: "Rotate" everything by iPos (-> iPos is the new zenith) and then all calculations for the
|
||||
// inner integral only depend on the sample height (iHeight) and sunTheta (angle between sun and new zenith).
|
||||
float sunTheta = acos(dot(normalize(iPos), normalize(pSun)));
|
||||
vec3 jODepth = nishita_lookupLUT(iHeight, sunTheta);// * vec3(14000000 / 255, 14000000 / 255, 2000000 / 255);
|
||||
vec3 jODepth = nishita_lookupLUT(iHeight, sunTheta);
|
||||
|
||||
// Apply dithering to reduce visible banding
|
||||
jODepth += mix(-1000, 1000, random(r.xy));
|
||||
|
|
|
@ -34,13 +34,11 @@ def write_vertpos(vert):
|
|||
|
||||
|
||||
def write_norpos(con_mesh: shader.ShaderContext, vert: shader.Shader, declare=False, write_nor=True):
|
||||
prep = ''
|
||||
if declare:
|
||||
prep = 'vec3 '
|
||||
is_bone = con_mesh.is_elem('bone')
|
||||
if is_bone:
|
||||
make_skin.skin_pos(vert)
|
||||
if write_nor:
|
||||
prep = 'vec3 ' if declare else ''
|
||||
if is_bone:
|
||||
make_skin.skin_nor(vert, prep)
|
||||
else:
|
||||
|
|
|
@ -1,7 +1,10 @@
|
|||
import bpy
|
||||
import arm.material.make_tess as make_tess
|
||||
|
||||
def make(con_mesh):
|
||||
import arm.material.make_tess as make_tess
|
||||
from arm.material.shader import ShaderContext
|
||||
|
||||
|
||||
def make(con_mesh: ShaderContext):
|
||||
vert = con_mesh.vert
|
||||
frag = con_mesh.frag
|
||||
geom = con_mesh.geom
|
||||
|
@ -32,7 +35,7 @@ def make(con_mesh):
|
|||
|
||||
write_wpos = False
|
||||
if frag.contains('vVec') and not frag.contains('vec3 vVec'):
|
||||
if tese != None:
|
||||
if tese is not None:
|
||||
tese.add_out('vec3 eyeDir')
|
||||
tese.add_uniform('vec3 eye', '_cameraPosition')
|
||||
tese.write('eyeDir = eye - wposition;')
|
||||
|
@ -48,7 +51,7 @@ def make(con_mesh):
|
|||
export_wpos = False
|
||||
if frag.contains('wposition') and not frag.contains('vec3 wposition'):
|
||||
export_wpos = True
|
||||
if tese != None:
|
||||
if tese is not None:
|
||||
export_wpos = True
|
||||
if vert.contains('wposition'):
|
||||
write_wpos = True
|
||||
|
@ -67,7 +70,7 @@ def make(con_mesh):
|
|||
vert.add_uniform('float posUnpack', link='_posUnpack')
|
||||
vert.write_attrib('mposition = spos.xyz * posUnpack;')
|
||||
|
||||
if tese != None:
|
||||
if tese is not None:
|
||||
if frag_mpos:
|
||||
make_tess.interpolate(tese, 'mposition', 3, declare_out=True)
|
||||
elif tese.contains('mposition') and not tese.contains('vec3 mposition'):
|
||||
|
@ -89,7 +92,7 @@ def make(con_mesh):
|
|||
vert.write_attrib('if (dim.y == 0) bposition.y = 0;')
|
||||
vert.write_attrib('if (dim.x == 0) bposition.x = 0;')
|
||||
|
||||
if tese != None:
|
||||
if tese is not None:
|
||||
if frag_bpos:
|
||||
make_tess.interpolate(tese, 'bposition', 3, declare_out=True)
|
||||
elif tese.contains('bposition') and not tese.contains('vec3 bposition'):
|
||||
|
@ -110,7 +113,7 @@ def make(con_mesh):
|
|||
vert.write('wtangent = normalize(N * tang.xyz);')
|
||||
vert.write_pre = False
|
||||
|
||||
if tese != None:
|
||||
if tese is not None:
|
||||
if frag_wtan:
|
||||
make_tess.interpolate(tese, 'wtangent', 3, declare_out=True)
|
||||
elif tese.contains('wtangent') and not tese.contains('vec3 wtangent'):
|
||||
|
|
Loading…
Reference in a new issue