Visible wall texture is 512px, bilinear filtering and mipmapping is on.
Without shaders:

Iterative Parallax Mapping:

Iterative Parallax Mapping + Normal Bumpmapping:




Dan Duncombe wrote:I saw no difference between them at all.
PilzAdam wrote:RealBadAngel wrote:PilzAdam wrote:Fake.
Sure:
Source or it didnt happen.
PilzAdam wrote:RealBadAngel wrote:PilzAdam wrote:Fake.
Sure:
Source or it didnt happen.
uniform sampler2D myTexture;
uniform sampler2D normalTexture;
uniform vec4 skyBgColor;
uniform float fogDistance;
uniform float scale;
varying vec2 texCoord;
varying vec3 vPosition;
varying vec3 viewVec;
varying vec3 eyeVec;
varying vec4 vertexViewPos;
varying vec4 vertexProjPos;
varying vec3 tsPosition;
varying vec3 tsCameraPosition;
varying vec3 tsLightSource;
void main (void)
{
float bumpScale = 0.15;
float shininess = 1.0;
vec4 normalMap;
vec2 offset = gl_TexCoord[0].st;
vec3 tsE = normalize(tsCameraPosition-tsPosition);
vec2 viewTS = vec2(-tsE.x, -tsE.y);// (tsE.z);
viewTS = normalize(viewTS);
for(int i = 0; i < 3; i++) {
normalMap = texture2D(normalTexture, offset);
float height = normalMap.a * 0.05 - 0.025;
offset += height * normalMap.z * viewTS * bumpScale ;
}
float alpha texture2D(myTexture, offset).a;
vec3 base = texture2D(myTexture, offset).xyz;
vec3 normal = texture2D(normalTexture, offset).xyz;
vec3 vVec = normalize(viewVec);
vec3 bump = normalize(normal * 2.0 - 1.0);
vec3 R = reflect(-viewVec, bump);
vec3 lVec = normalize(vec3(0.0, -0.4, 0.5));
float diffuse = max(dot(lVec, bump), 0.0);
float specular = pow(clamp(dot(R, lVec), 0.0, 1.0),1.0);
vec3 color = diffuse * base + 0.4 * diffuse * specular;
vec4 col = vec4(color.r, color.g, color.b, alpha);
col *= gl_Color;
col = col * col; // SRGB -> Linear
col *= 1.8;
col.r = 1.0 - exp(1.0 - col.r) / exp(1.0);
col.g = 1.0 - exp(1.0 - col.g) / exp(1.0);
col.b = 1.0 - exp(1.0 - col.b) / exp(1.0);
col = sqrt(col); // Linear -> SRGB
if(fogDistance != 0.0){
float d = max(0.0, min(vPosition.z / fogDistance * 1.5 - 0.6, 1.0));
alpha = mix(alpha, 0.0, d);
}
gl_FragColor = vec4(col.r, col.g, col.b, alpha);
}
RealBadAngel wrote:PilzAdam wrote:RealBadAngel wrote:
Sure:
Source or it didnt happen.Your phone or window isn't wide enough to display the code box. If it's a phone, try rotating it to landscape mode.
- Code: Select all
uniform sampler2D myTexture;
uniform sampler2D normalTexture;
uniform vec4 skyBgColor;
uniform float fogDistance;
uniform float scale;
varying vec2 texCoord;
varying vec3 vPosition;
varying vec3 viewVec;
varying vec3 eyeVec;
varying vec4 vertexViewPos;
varying vec4 vertexProjPos;
varying vec3 tsPosition;
varying vec3 tsCameraPosition;
varying vec3 tsLightSource;
void main (void)
{
float bumpScale = 0.15;
float shininess = 1.0;
vec4 normalMap;
vec2 offset = gl_TexCoord[0].st;
vec3 tsE = normalize(tsCameraPosition-tsPosition);
vec2 viewTS = vec2(-tsE.x, -tsE.y);// (tsE.z);
viewTS = normalize(viewTS);
for(int i = 0; i < 3; i++) {
normalMap = texture2D(normalTexture, offset);
float height = normalMap.a * 0.05 - 0.025;
offset += height * normalMap.z * viewTS * bumpScale ;
}
float alpha texture2D(myTexture, offset).a;
vec3 base = texture2D(myTexture, offset).xyz;
vec3 normal = texture2D(normalTexture, offset).xyz;
vec3 vVec = normalize(viewVec);
vec3 bump = normalize(normal * 2.0 - 1.0);
vec3 R = reflect(-viewVec, bump);
vec3 lVec = normalize(vec3(0.0, -0.4, 0.5));
float diffuse = max(dot(lVec, bump), 0.0);
float specular = pow(clamp(dot(R, lVec), 0.0, 1.0),1.0);
vec3 color = diffuse * base + 0.4 * diffuse * specular;
vec4 col = vec4(color.r, color.g, color.b, alpha);
col *= gl_Color;
col = col * col; // SRGB -> Linear
col *= 1.8;
col.r = 1.0 - exp(1.0 - col.r) / exp(1.0);
col.g = 1.0 - exp(1.0 - col.g) / exp(1.0);
col.b = 1.0 - exp(1.0 - col.b) / exp(1.0);
col = sqrt(col); // Linear -> SRGB
if(fogDistance != 0.0){
float d = max(0.0, min(vPosition.z / fogDistance * 1.5 - 0.6, 1.0));
alpha = mix(alpha, 0.0, d);
}
gl_FragColor = vec4(col.r, col.g, col.b, alpha);
}
PilzAdam wrote:You should hardcode the result of exp(1.0), Exio said it gives a nice FPS boost.
PilzAdam wrote:You should hardcode the result of exp(1.0), Exio said it gives a nice FPS boost.
Inocudom wrote:PilzAdam wrote:You should hardcode the result of exp(1.0), Exio said it gives a nice FPS boost.
What is exp(1.0) supposed to be, and how would it be able to speed up Minetest's FPS? If it can speed up Minetest's FPS, then it is a worthwhile effort, though it might be easier to do if more than one person works on it. Besides RealBadAngel, is there anyone else that is skilled in such an area?
RealBadAngel wrote:about shaders only person i know of who played a bit with them is Jeija
PilzAdam wrote:RealBadAngel wrote:about shaders only person i know of who played a bit with them is Jeija
kahrl wrote the whole shader support in Minetest, celeron55 rebased it and Exio found that exp(1.0) hardcoding thing out; so there are a few people who know whats going on.
Mito551 wrote:PilzAdam wrote:Fake.
and gay.
Inocudom wrote:Mito551 wrote:PilzAdam wrote:Fake.
and gay.
What is wrong with parallax mapping? It makes textures look more real. Check out Xonotic if you don't believe me.
It is starting to sound as if only me, VanessaE, and RealBadAngel himself will use this. I hope I can be proved wrong to that end.
Hybrid Dog wrote:Since there's an ability to use bumpmapping my shaders doesn't work. Everything is red. But before it worked.VanessaE wrote:The red comes from the shaders being written in a language (GLSL) that your video driver mode (probably DirectX) doesn't understand. You either have to switch to OpenGL mode, or you won't be able to use shaders at all.
Dan Duncombe wrote:Hybrid Dog wrote:Since there's an ability to use bumpmapping my shaders doesn't work. Everything is red. But before it worked.VanessaE wrote:The red comes from the shaders being written in a language (GLSL) that your video driver mode (probably DirectX) doesn't understand. You either have to switch to OpenGL mode, or you won't be able to use shaders at all.
Could we have an option for bumpmapping without shaders? That would be nice.
Mito551 wrote:RBA, any chance you could demonstrate how that looks with 16/32px textures?
Inocudom wrote:Mito551 wrote:RBA, any chance you could demonstrate how that looks with 16/32px textures?
It might not look good with those, but 64px and above should look fine.
RealBadAngel wrote:Btw, closer look at bricks...
Mito551 wrote:Mito551 wrote:RBA, any chance you could demonstrate how that looks with 16/32px textures?
so?
Users browsing this forum: No registered users and 4 guests