forked from teamnwah/openmw-tes3coop
transparency
This commit is contained in:
parent
19ecc7f890
commit
9bd888d9a1
16 changed files with 144 additions and 7 deletions
|
@ -246,6 +246,33 @@ void NIFLoader::createMaterial(const String &name,
|
|||
|
||||
instance->setProperty ("diffuseMap", sh::makeProperty(texName));
|
||||
|
||||
// Add transparency if NiAlphaProperty was present
|
||||
if (alphaFlags != -1)
|
||||
{
|
||||
// The 237 alpha flags are by far the most common. Check
|
||||
// NiAlphaProperty in nif/property.h if you need to decode
|
||||
// other values. 237 basically means normal transparencly.
|
||||
if (alphaFlags == 237)
|
||||
{
|
||||
NifOverrides::TransparencyResult result = NifOverrides::Overrides::getTransparencyOverride(texName);
|
||||
if (result.first)
|
||||
{
|
||||
instance->setProperty("alpha_rejection_func", sh::makeProperty<sh::StringValue>(new sh::StringValue("greater_equal")));
|
||||
instance->setProperty("alpha_rejection_value", sh::makeProperty<sh::IntValue>(new sh::IntValue(result.second)));
|
||||
}
|
||||
else
|
||||
{
|
||||
// Enable transparency
|
||||
instance->setProperty("scene_blend", sh::makeProperty<sh::StringValue>(new sh::StringValue("alpha_blend")));
|
||||
instance->setProperty("depth_write", sh::makeProperty<sh::BooleanValue>(new sh::BooleanValue(false)));
|
||||
}
|
||||
}
|
||||
else
|
||||
warn("Unhandled alpha setting for texture " + texName);
|
||||
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
if (!texName.empty())
|
||||
{
|
||||
|
|
2
extern/shiny
vendored
2
extern/shiny
vendored
|
@ -1 +1 @@
|
|||
Subproject commit 6080431c8ce37c6044dd7d1e319de3c7b8adfd69
|
||||
Subproject commit 3a1b8e2aefa746ef0922e78f4be3ff736ce92fc3
|
0
files/materials/atmosphere.shader
Normal file
0
files/materials/atmosphere.shader
Normal file
0
files/materials/atmosphere.shaderset
Normal file
0
files/materials/atmosphere.shaderset
Normal file
0
files/materials/clouds.shader
Normal file
0
files/materials/clouds.shader
Normal file
0
files/materials/clouds.shaderset
Normal file
0
files/materials/clouds.shaderset
Normal file
0
files/materials/moon.shader
Normal file
0
files/materials/moon.shader
Normal file
0
files/materials/moon.shaderset
Normal file
0
files/materials/moon.shaderset
Normal file
|
@ -7,7 +7,11 @@ material openmw_objects_base
|
|||
has_vertex_colour false
|
||||
diffuseMap black.png
|
||||
fog true
|
||||
|
||||
is_transparent false // real transparency, alpha rejection doesn't count here
|
||||
scene_blend default
|
||||
alpha_rejection_value default
|
||||
alpha_rejection_func default
|
||||
|
||||
pass
|
||||
{
|
||||
|
@ -24,6 +28,9 @@ material openmw_objects_base
|
|||
has_vertex_colour $has_vertex_colour
|
||||
|
||||
is_transparent $is_transparent
|
||||
scene_blend $scene_blend
|
||||
alpha_rejection_value $alpha_rejection_value
|
||||
alpha_rejection_func $alpha_rejection_func
|
||||
|
||||
texture_unit diffuseMap
|
||||
{
|
||||
|
|
|
@ -20,17 +20,17 @@
|
|||
shOutput(float2, UV)
|
||||
shNormalInput(float4)
|
||||
shOutput(float4, normalPassthrough)
|
||||
#ifdef NEED_DEPTH
|
||||
#ifdef NEED_DEPTH
|
||||
shOutput(float, depthPassthrough)
|
||||
#endif
|
||||
#endif
|
||||
SH_START_PROGRAM
|
||||
{
|
||||
shOutputPosition = shMatrixMult(wvp, shInputPosition);
|
||||
UV = uv0;
|
||||
normalPassthrough = normal;
|
||||
#ifdef NEED_DEPTH
|
||||
#ifdef NEED_DEPTH
|
||||
depthPassthrough = shOutputPosition.z;
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
|
||||
#else
|
||||
|
@ -41,9 +41,9 @@
|
|||
shDeclareMrtOutput(1)
|
||||
shInput(float4, normalPassthrough)
|
||||
|
||||
#ifdef NEED_DEPTH
|
||||
#ifdef NEED_DEPTH
|
||||
shInput(float, depthPassthrough)
|
||||
#endif
|
||||
#endif
|
||||
|
||||
shUniform(float far) @shAutoConstant(far, far_clip_distance)
|
||||
|
||||
|
|
73
files/materials/sky.mat
Normal file
73
files/materials/sky.mat
Normal file
|
@ -0,0 +1,73 @@
|
|||
material openmw_moon
|
||||
{
|
||||
pass
|
||||
{
|
||||
vertex_program moon_vertex
|
||||
fragment_program moon_fragment
|
||||
|
||||
texture_unit diffuseMap
|
||||
{
|
||||
texture $diffuseMap
|
||||
create_in_ffp true
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
material openmw_clouds
|
||||
{
|
||||
pass
|
||||
{
|
||||
vertex_program clouds_vertex
|
||||
fragment_program clouds_fragment
|
||||
|
||||
// second diffuse map is used for weather transitions
|
||||
texture_unit diffuseMap1
|
||||
{
|
||||
texture $diffuseMap1
|
||||
create_in_ffp true
|
||||
}
|
||||
|
||||
texture_unit diffuseMap2
|
||||
{
|
||||
texture $diffuseMap2
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
material openmw_atmosphere
|
||||
{
|
||||
pass
|
||||
{
|
||||
vertex_program atmosphere_vertex
|
||||
fragment_program atmosphere_fragment
|
||||
}
|
||||
}
|
||||
|
||||
material openmw_stars
|
||||
{
|
||||
pass
|
||||
{
|
||||
vertex_program stars_vertex
|
||||
fragment_program stars_fragment
|
||||
|
||||
texture_unit diffuseMap
|
||||
{
|
||||
diffuseMap $diffuseMap
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// used for both sun and sun glare
|
||||
material openmw_sun
|
||||
{
|
||||
pass
|
||||
{
|
||||
vertex_program sun_vertex
|
||||
fragment_program sun_fragment
|
||||
|
||||
texture unit diffuseMap
|
||||
{
|
||||
diffuseMap $diffuseMap
|
||||
}
|
||||
}
|
||||
}
|
0
files/materials/sun.shader
Normal file
0
files/materials/sun.shader
Normal file
0
files/materials/sun.shaderset
Normal file
0
files/materials/sun.shaderset
Normal file
30
files/materials/water.mat
Normal file
30
files/materials/water.mat
Normal file
|
@ -0,0 +1,30 @@
|
|||
// note: the fixed function water is created manually, not here
|
||||
|
||||
material openmw_water
|
||||
{
|
||||
pass
|
||||
{
|
||||
vertex_program water_vertex
|
||||
fragment_program water_fragment
|
||||
|
||||
texture_unit reflectionMap
|
||||
{
|
||||
texture_alias WaterReflection
|
||||
}
|
||||
|
||||
texture_unit refractionMap
|
||||
{
|
||||
texture_alias WaterRefraction
|
||||
}
|
||||
|
||||
texture_unit depthMap
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
texture_unit normalMap
|
||||
{
|
||||
texture
|
||||
}
|
||||
}
|
||||
}
|
0
files/materials/water.shader
Normal file
0
files/materials/water.shader
Normal file
0
files/materials/water.shaderset
Normal file
0
files/materials/water.shaderset
Normal file
Loading…
Reference in a new issue