mirror of
https://github.com/ioquake/ioq3.git
synced 2024-11-09 23:01:51 +00:00
Add r_parallaxMapOffset.
This commit is contained in:
parent
66cb20a7f3
commit
69ec389335
5 changed files with 14 additions and 0 deletions
|
@ -89,6 +89,9 @@ float RayIntersectDisplaceMap(vec2 dp, vec2 ds, sampler2D normalMap)
|
|||
// current size of search window
|
||||
float size = 1.0 / float(linearSearchSteps);
|
||||
|
||||
// adjust position if offset above surface
|
||||
dp -= ds * r_parallaxMapOffset;
|
||||
|
||||
// current depth position
|
||||
float depth = 0.0;
|
||||
|
||||
|
@ -142,6 +145,7 @@ float RayIntersectDisplaceMap(vec2 dp, vec2 ds, sampler2D normalMap)
|
|||
#endif
|
||||
|
||||
return bestDepth;
|
||||
return bestDepth - r_parallaxMapOffset;
|
||||
}
|
||||
|
||||
float LightRay(vec2 dp, vec2 ds, sampler2D normalMap)
|
||||
|
|
|
@ -1125,6 +1125,8 @@ void GLSL_InitGPUShaders(void)
|
|||
|
||||
if (r_parallaxMapShadows->integer)
|
||||
Q_strcat(extradefines, 1024, "#define USE_PARALLAXMAP_SHADOWS\n");
|
||||
|
||||
Q_strcat(extradefines, 1024, va("#define r_parallaxMapOffset %f\n", r_parallaxMapOffset->value));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -132,6 +132,7 @@ cvar_t *r_normalMapping;
|
|||
cvar_t *r_specularMapping;
|
||||
cvar_t *r_deluxeMapping;
|
||||
cvar_t *r_parallaxMapping;
|
||||
cvar_t *r_parallaxMapOffset;
|
||||
cvar_t *r_parallaxMapShadows;
|
||||
cvar_t *r_cubeMapping;
|
||||
cvar_t *r_cubemapSize;
|
||||
|
@ -1243,6 +1244,7 @@ void R_Register( void )
|
|||
r_specularMapping = ri.Cvar_Get( "r_specularMapping", "1", CVAR_ARCHIVE | CVAR_LATCH );
|
||||
r_deluxeMapping = ri.Cvar_Get( "r_deluxeMapping", "1", CVAR_ARCHIVE | CVAR_LATCH );
|
||||
r_parallaxMapping = ri.Cvar_Get( "r_parallaxMapping", "0", CVAR_ARCHIVE | CVAR_LATCH );
|
||||
r_parallaxMapOffset = ri.Cvar_Get( "r_parallaxMapOffset", "0", CVAR_ARCHIVE | CVAR_LATCH );
|
||||
r_parallaxMapShadows = ri.Cvar_Get( "r_parallaxMapShadows", "0", CVAR_ARCHIVE | CVAR_LATCH );
|
||||
r_cubeMapping = ri.Cvar_Get( "r_cubeMapping", "0", CVAR_ARCHIVE | CVAR_LATCH );
|
||||
r_cubemapSize = ri.Cvar_Get( "r_cubemapSize", "128", CVAR_ARCHIVE | CVAR_LATCH );
|
||||
|
|
|
@ -1778,6 +1778,7 @@ extern cvar_t *r_normalMapping;
|
|||
extern cvar_t *r_specularMapping;
|
||||
extern cvar_t *r_deluxeMapping;
|
||||
extern cvar_t *r_parallaxMapping;
|
||||
extern cvar_t *r_parallaxMapOffset;
|
||||
extern cvar_t *r_parallaxMapShadows;
|
||||
extern cvar_t *r_cubeMapping;
|
||||
extern cvar_t *r_cubemapSize;
|
||||
|
|
|
@ -184,6 +184,11 @@ Cvars for advanced material usage:
|
|||
1 - Use parallax occlusion mapping.
|
||||
2 - Use relief mapping. (slower)
|
||||
|
||||
* `r_parallaxMapOffset` - Set the parallax height offset.
|
||||
0 - Values map to -255 - 0. (default)
|
||||
0.5 - Values map to -127 - 127.
|
||||
1.0 - Values map to 0 - 255.
|
||||
|
||||
* `r_parallaxMapShadows` - Enable self-shadowing on parallax map
|
||||
supported materials.
|
||||
0 - No. (default)
|
||||
|
|
Loading…
Reference in a new issue