One Minute Game Review by The Happy Friar: https://ugetube.com/@OneMinteGameReviewsAlso on Rumble: https://rumble.com/c/c-1115371idTech 4 (aka Doom 3 tech) Discord Server! https://discord.gg/9wtCGHa
0 Members and 1 Guest are viewing this topic.
const float Eta = 0.67; // Ratio of indices of refraction (air -> glass)const float FresnelPower = 10.0; // Controls degree of reflectivity at grazing angles const float F = ((1.0 - Eta) * (1.0 - Eta)) / ((1.0 + Eta) * (1.0 + Eta)); varying vec3 Reflect;varying vec3 Refract;varying float Ratio; attribute vec3 normal; uniform vec3 viewer; void main( void ){ vec4 worldPosition = calcWorldPos( gl_Vertex ); vec3 ecPosition3 = worldPosition.xyz - viewer; vec3 i = normalize(ecPosition3); vec3 n = normalize( calcWorldVec(normal) ); Ratio = F + (1.0 - F) * pow((1.0 - dot(-i, n)), FresnelPower); //Ratio = 1.0 - Ratio; // Add this line if your cube map is not based on the right side Refract = refract(i, n, Eta); Refract = vec3(gl_TextureMatrix[0] * vec4(Refract, 1.0)); Reflect = reflect(i, n); Reflect = vec3(gl_TextureMatrix[0] * vec4(Reflect, 1.0)); gl_Position = gl_ModelViewProjectionMatrix * worldPosition;}
varying vec3 Reflect;varying vec3 Refract;varying float Ratio; uniform samplerCube tex0; void main(void){ vec3 refractColor = vec3 (textureCube(tex0, Refract)); vec3 reflectColor = vec3 (textureCube(tex0, Reflect)); vec3 color = mix(refractColor, reflectColor, Ratio); gl_FragColor = vec4(color, 1.0);}
textures/bod/rock/shiny_mot088{ surftype10 //tile qer_editorimage textures/bod/rock/mot088_ed.jpg { blend bumpmap map textures/bod/rock/mot088_local.tga } diffusemap textures/bod/rock/mot088.tga specularmap textures/bod/rock/mot088_s.tga { blend blend mirrorRenderMap 128 128 translate 0.5, 0.5 scale 0.5, 0.5 vertexProgram fresnel_vertex.glsl vertexParm Eta 0.67 // Ratio of indices of refraction (air -> glass) vertexParm FresnelPower 10.0 // Controls degree of reflectivity at grazing angles fragmentProgram fresnel_fragment.glsl fragmentMap tex0 _scratch alpha 0.6 }
I'm asking because i tried to dmap a simple map using RBDoom3 and it didn't worked.
d3map is functional I've compiled several maps of mine and all worked fine. take a look tough to the launch options recommended in the modding section of the readme (12th section) you have to use several cvar in order for the engine to recognize your new content in the mod folder
on the vertex/fragment program issue, I've never tried to use a fragment in the bfg but maybe you can try to call an in-existing vfp program that bears the same name as your glsl (sort of how the textures with heat-haze do it in the game) and then the engine will use the heat-haze take a look in inolen water mod (you can see it in the section of "making water" in the darkmodwiki there is Vertex's or Inolen's water shader material which calls a fresnel vfp), try to make it call your program to see if it works ( sort of how d3bfg didn't contain the old vfp files but still they where called whithin the materials, and yet you could see heat-haze effects in d3 bfg)
Can you please elaborate ? I looked into RBDoom 3's dmap port, and while I haven't tried it, it looks like a lot of stuff is missing.
if you try to dmap the map, and then after finished compiling you restart the engine, does then opening the map crash the engine?