Jump to content

Normal maps (and rend2)


Recommended Posts

Posted

I wondered what the trick is to make normal maps look correct in rend2 (or in baseJKA for that matter). At the moment it looks and behaves the same way it did when I tried this a year-ish ago before rend2 was in the works/ports. It all looks like big plastic bubbles, or the textures get random dark spots spread out, no matter what I test it on.

 

Shader:

 

 

  Reveal hidden contents

 

 

Test-screenshots:

 

 

 

Posted

Lightmaps are very low-res. If there's a shadow from a normal map on it it'll usually be pretty big. Q3Map2's normal maps are really not useful for much, even at lower lightmapscales.

 

I don't know about rend2.

Posted

To make normal maps work with rend2, you need this kind of shader:

 

    textures/vehicles/car
    {
        qer_editorimage textures/vehicles/car.jpg

        {
            map textures/vehicles/car.jpg
            rgbGen vertexLit
        }
        {
            stage normalparallaxmap
            map textures/vehicles/car_n.jpg
        }
        {
            stage specularmap
            map textures/vehicles/car_s.jpg
        }
    }

Fake bump mapping should only be used for vanilla renderer.

Boothand likes this
Posted

Hmm I'm starting to suspect I haven't been running rend2 properly if at all. Might explain why I didn't ever see a difference. I compiled rend2 (from openjk's rend2 branch) just like openJK, with rend2 included, and threw the DLLs in my GameData folder. Feel free to point me to the correct way of doing it!

 

In any case, the main error I got in-game was that the "stage" keyword wasn't recognized.

Posted

Rend2 uses a specific normalmap shader line which doesnt exist in baseja or q3map2. This must be put into a .mtr file which will overwrite the info in the .shader file (should your renderer be set to rd-rend2)

 

q3map2 "faked" bumpmaps/normalmaps arent all that great - theres a tutorial on how to use it properly in the tuts section. Remember, the bigger the brush the lower quality the lightmap as theyre always 128x128 pixels and so look much worse over bigger lightmap surfaces, so you're best using multiple small patches to get the best effects.

 

Did you actually change to the rend2 renderer using "cl_renderer rd-rend2" (into the console?)

Posted
  On 2/25/2014 at 1:11 PM, Szico VII said:

Rend2 uses a specific normalmap shader line which doesnt exist in baseja or q3map2. This must be put into a .mtr file which will overwrite the info in the .shader file (should your renderer be set to rd-rend2)

[...]

Did you actually change to the rend2 renderer using "cl_renderer rd-rend2" (into the console?)

 

Ah, I hadn't! Have I missed out on any crucial guides I should read? :D

 

Ok, so I'm currently crashing on startup, as it can't read my old shaders. I understand it you can use both .shader or .mtr. But all the normalmap shaders must be in .mtr then?

 

I suppose my other shaders are currently incompatible the way they're written? This is what I can find at the moment: http://jkhub.org/topic/2865-rend2-shader-manual/

Posted

It can read old shaders exactly as the base renderer does.

 

Your .mtr will basically be an identical copy of your original .shader, WITH any rend2 specific stages (such as normalparralaxmap) added to make use of its features. That way users can swap between renderers at will with no compatibility issues.

Boothand likes this
Posted
Hmm, okay, I copied the shader where I put all my normalmaps, named it the same with .mtr. Then I deleted the stages that were rend2 specific in the original .shader one.

 

I suspect something else may be causing this error though.

 

Huge console dump:

 

  Reveal hidden contents

 



OpenJK-MP: v1.0.1.0 win_msvc-x86 Feb 24 2014
----- FS_Startup -----
Current search path:
C:\Users\Rune\Documents\My Games\OpenJK\base
C:\Spel\JKA\GameData\base\templeofmechanism.pk3 (96 files)
C:\Spel\JKA\GameData\base\szico_bootland.pk3 (23 files)
C:\Spel\JKA\GameData\base\moose.pk3 (7 files)
C:\Spel\JKA\GameData\base\mapextras.pk3 (55 files)
C:\Spel\JKA\GameData\base\BlueIce Nightfall.pk3 (248 files)
C:\Spel\JKA\GameData\base\assets3.pk3 (16 files)
C:\Spel\JKA\GameData\base\assets2.pk3 (62 files)
C:\Spel\JKA\GameData\base\assets1.pk3 (8320 files)
C:\Spel\JKA\GameData\base\assets0.pk3 (15346 files)
C:\Spel\JKA\GameData\base

----------------------
24173 files in pk3 files
execing mpdefault.cfg
execing openjk.cfg
couldn't exec autoexec.cfg

------- Input Initialization -------
Skipping check for DirectInput
Joystick is not active.
------------------------------------
----- Initializing Renderer ----
Trying to load "rd-rend2_x86.dll" from "C:\Spel\JKA\GameData"...
QKEY found.
----- R_Init -----
...initializing QGL
succeeded
...setting mode 8: 1280 1024 FS
...using colorsbits of 32
...calling CDS: failed, bad mode
...trying next higher resolution: failed, bad mode
...restoring display settings
...WARNING: fullscreen unavailable in this mode
...setting mode 3: 640 480 FS
...using colorsbits of 16
...calling CDS: ok
...created window@0,0 (640x480)
Initializing OpenGL driver
...getting DC: succeeded
...GLW_ChoosePFD( 16, 24, 8 )
...65 PFDs found
...hardware acceleration found
...PIXELFORMAT 2 selected
...creating GL context: succeeded
...making context current: succeeded
Initializing OpenGL extensions
...GL_EXT_texture_compression_s3tc available
...ignoring texture compression
...using GL_EXT_texture_env_add
...GL_EXT_texture_filter_anisotropic available
...using GL_EXT_texture_filter_anisotropic
...Using GL_EXT_texture_edge_clamp
...using WGL_EXT_swap_control
...using GL_ARB_multitexture
...using GL_EXT_compiled_vertex_array
...using GL_EXT_point_parameters
...GL_NV_register_combiners not found
...using GL_EXT_draw_range_elements
...using GL_EXT_multi_draw_arrays
...using GL_ARB_vertex_program
...using GL_ARB_vertex_buffer_object
...using GL_ARB_shader_objects
...using GL_ARB_vertex_shader
...using GLSL version 1.30
...using GL_ARB_texture_non_power_of_two
...using GL_ARB_texture_float
...using GL_ARB_half_float_pixel
...using GL_EXT_framebuffer_object
...using GL_EXT_packed_depth_stencil
...using GL_ARB_occlusion_query
...using GL_EXT_framebuffer_blit
...using GL_EXT_framebuffer_multisample
...ignoring GL_EXT_texture_sRGB
...ignoring GL_EXT_framebuffer_sRGB
...GL_EXT_texture_sRGB_decode not found
...ignoring GL_EXT_texture_compression_latc
...GL_ARB_texture_compression_bptc not found
...using GL_ARB_draw_buffers
...GL_ARB_depth_clamp not found
...GL_ARB_seamless_cube_map not found
------- FBO_Init -------
------- GLSL_InitGPUShaders -------
#version 130
#define varying in
out vec4 out_Color;
#define gl_FragColor out_Color
#ifndef M_PI
#define M_PI 3.14159265358979323846f
#endif
#ifndef deformGen_t
#define deformGen_t
#define DGEN_WAVE_SIN 1
#define DGEN_WAVE_SQUARE 2
#define DGEN_WAVE_TRIANGLE 3
#define DGEN_WAVE_SAWTOOTH 4
#define DGEN_WAVE_INVERSE_SAWTOOTH 5
#define DGEN_BULGE 7
#define DGEN_MOVE 8
#endif
#ifndef tcGen_t
#define tcGen_t
#define TCGEN_LIGHTMAP 2
#define TCGEN_TEXTURE 3
#define TCGEN_ENVIRONMENT_MAPPED 4
#define TCGEN_FOG 5
#define TCGEN_VECTOR 6
#endif
#ifndef colorGen_t
#define colorGen_t
#define CGEN_LIGHTING_DIFFUSE 11
#endif
#ifndef alphaGen_t
#define alphaGen_t
#define AGEN_LIGHTING_SPECULAR 6
#define AGEN_PORTAL 8
#endif
#ifndef texenv_t
#define texenv_t
#define TEXENV_MODULATE 8448
#define TEXENV_ADD 260
#define TEXENV_REPLACE 7681
#endif
#ifndef r_FBufScale
#define r_FBufScale vec2(0.001563, 0.002083)
#endif
#define RGBM_LIGHTMAP
#line 0
uniform sampler2D u_DiffuseMap;

#if defined(USE_LIGHTMAP)
uniform sampler2D u_Lig
tMap;

uniform int u_Texture1Env;
#endif

varying vec2 var_DiffuseTex;

#if defined(USE_LIGHTMAP)
varying vec2 var_LightTex;
#endif

varying vec4 var_Color;


void main()
{
vec4 color = texture2D(u_DiffuseMap, var_DiffuseTex);
#if defined(USE_LIGHTMAP)
vec4 color2 = texture2D(u_LightMap, var_LightTex);
#if defined(RGBM_LIGHTMAP)
color2.rgb *= 32.0 * color2.a;
color2.a = 1.0;
#endif

if (u_Texture1Env == TEXENV_MODULATE)
{
color *= color2;
}
else if (u_Texture1Env == TEXENV_ADD)
{
color += color2;
}
else if (u_Texture1Env == TEXENV_REPLACE)
{
color = color2;
}
#endif

gl_FragColor = color * var_Color;
}

compile log:
Fragment shader failed to compile with the following errors:
ERROR: 0:3: '' : Declaration must include a precision qualifier or the default precision must have been previously declared.
ERROR: 0:9: '' : Declaration must include a precision qualifier or the default precision must have been previously declared.
ERROR: 0:15: '' : Declaration must include a precision qualifier or the default precision must have been previously declared.
ERROR: 0:20: '' : Declaration must include a precision qualifier or the default precision must have been previously declared.
ERROR: compilation errors. No code generated.

*******************
ERROR: Couldn't compile shader
********************
RE_Shutdown( 0 )
----- R_Init -----
------- FBO_Init -------
------- GLSL_InitGPUShaders -------
#version 130
#define varying in
out vec4 out_Color;
#define gl_FragColor out_Color
#ifndef M_PI
#define M_PI 3.14159265358979323846f
#endif
#ifndef deformGen_t
#define deformGen_t
#define DGEN_WAVE_SIN 1
#define DGEN_WAVE_SQUARE 2
#define DGEN_WAVE_TRIANGLE 3
#define DGEN_WAVE_SAWTOOTH 4
#define DGEN_WAVE_INVERSE_SAWTOOTH 5
#define DGEN_BULGE 7
#define DGEN_MOVE 8
#endif
#ifndef tcGen_t
#define tcGen_t
#define TCGEN_LIGHTMAP 2
#define TCGEN_TEXTURE 3
#define TCGEN_ENVIRONMENT_MAPPED 4
#define TCGEN_FOG 5
#define TCGEN_VECTOR 6
#endif
#ifndef colorGen_t
#define colorGen_t
#define CGEN_LIGHTING_DIFFUSE 11
#endif
#ifndef alphaGen_t
#define alphaGen_t
#define AGEN_LIGHTING_SPECULAR 6
#define AGEN_PORTAL 8
#endif
#ifndef texenv_t
#define texenv_t
#define TEXENV_MODULATE 8448
#define TEXENV_ADD 260
#define TEXENV_REPLACE 7681
#endif
#ifndef r_FBufScale
#define r_FBufScale vec2(0.001563, 0.002083)
#endif
#define RGBM_LIGHTMAP
#line 0
uniform sampler2D u_DiffuseMap;

#if defined(USE_LIGHTMAP)
uniform sampler2D u_Lig
tMap;

uniform int u_Texture1Env;
#endif

varying vec2 var_DiffuseTex;

#if defined(USE_LIGHTMAP)
varying vec2 var_LightTex;
#endif

varying vec4 var_Color;


void main()
{
vec4 color = texture2D(u_DiffuseMap, var_DiffuseTex);
#if defined(USE_LIGHTMAP)
vec4 color2 = texture2D(u_LightMap, var_LightTex);
#if defined(RGBM_LIGHTMAP)
color2.rgb *= 32.0 * color2.a;
color2.a = 1.0;
#endif

if (u_Texture1Env == TEXENV_MODULATE)
{
color *= color2;
}
else if (u_Texture1Env == TEXENV_ADD)
{
color += color2;
}
else if (u_Texture1Env == TEXENV_REPLACE)
{
color = color2;
}
#endif

gl_FragColor = color * var_Color;
}

compile log:
Fragment shader failed to compile with the following errors:
ERROR: 0:3: '' : Declaration must include a precision qualifier or the default precision must have been previously declared.
ERROR: 0:9: '' : Declaration must include a precision qualifier or the default precision must have been previously declared.
ERROR: 0:15: '' : Declaration must include a precision qualifier or the default precision must have been previously declared.
ERROR: 0:20: '' : Declaration must include a precision qualifier or the default precision must have been previously declared.
ERROR: compilation errors. No code generated.

recursive error after: Couldn't compile shader




Posted
  On 2/25/2014 at 2:08 PM, Szico VII said:

Likely is that the rend2 hasnt compiled right.....

 

After compiling it, is there anywhere else I should put the files? I see there's a search patch to Games/Openjk etc, and I've tried replacing those too with rend2 ones. Think I replaced the ones in fabulous_openjk.pk3 too. Got no errors on compile at least, so I'd think it rather had to do with the process after that.

Posted

It just goes into gamedata... Hold on, Xycaleth gave me his compiled version, try those and see if it works. All files into gamedata. And have the latest openJK. Dont replace anything in the openJk folder

Posted
  On 2/25/2014 at 2:13 PM, Szico VII said:

It just goes into gamedata... Hold on, Xycaleth gave me his compiled version, try those and see if it works. All files into gamedata. And have the latest openJK. Dont replace anything in the openJk folder

 

Ok, this works, but there's a hitch! I deleted the My games/openJK folder prior to testing it. Worked. When I've started the game, that folder now exists again with some files. Now I can't open the game again (or vid_restart) without the same error. If I delete it again, it works. And so on...

Posted

Once you have the IO problems sorted, the next step is to make a better normal map. It's clear that an texture->normal map generator was used and that results in obvious ugliness. Here is what you can expect it to look like:

 

https://jkhub.org/images/xl9knzp.png

 

You'll need to render a normal map from a 3d program or convert a heightmap into a normal map the same way the door texture was done, or using a program like Xnormal. 

Boothand likes this
Posted

Yeah that's the next step. Might be able to make some bump files manually actually.

 

Should fs_homepath really be set to [...]/My Games/OpenJK?

That's the folder in any case that's causing me trouble, it seems. What if I'd set it to gamedata? What is it actually? :D

Posted
  On 2/25/2014 at 5:02 PM, Boothand said:

What is it actually? :D

It's where OpenJK writes its files. From Vista onward Windows finally does proper access rights and keeps normal users from changing files in the Program Files folder, where you'd install Jedi Academy (that is, the Admin would). Anything the user wants to write should go to his user directory (though people can't seem to agree on where in there exactly), which is where fs_homepath points by default, because you can't write to the folder JKA is installed to.
Posted

I see.

 

Using a HP laptop I bought about 5 years ago, it has windows 7 and is quite freshly formatted.

Tried rend2 just now on a healthy clean steam-install of the game, but as soon as I switch the renderer to rd-rend2, it crashes with the error.

 

Not sure if it has changed since my first error I posted, so I'll post another huge console dump. In about a week I'll be able to test on a stationary PC with different cards.

 

 

  Reveal hidden contents

 

Posted

1) Get OpenJk latest build from their buildbot links --> Unzip it to gamedata/

2) Add the rend2.dll that I sent you to gamedata

3) Run openjk.x86.exe with clean base and patch 1.01 (to start with)

4) Load a default map (I.E HAVE NO CUSTOM FILES IN BASE INCLUDING .mtr

5) cl_renderer rd-rend2

6) vid_restart

 

Any luck?

 

(Also, youre on windows right?)

Posted
  On 2/25/2014 at 7:27 PM, Szico VII said:

1) Get OpenJk latest build from their buildbot links --> Unzip it to gamedata/

2) Add the rend2.dll that I sent you to gamedata

3) Run openjk.x86.exe with clean base and patch 1.01 (to start with)

4) Load a default map (I.E HAVE NO CUSTOM FILES IN BASE INCLUDING .mtr

5) cl_renderer rd-rend2

6) vid_restart

 

Any luck?

 

(Also, youre on windows right?)

 

For the cleanliness tests, I usually use the steam version, it comes already patched.

 

Didn't wanna bother with technicalities with screen capture, so here you go:

 

 

 

@@mrwonko

 

Dxdiag:

 

  Reveal hidden contents

 

Posted
  On 2/25/2014 at 9:56 PM, Szico VII said:

And the completely clean base folder?

 

It only had default assets (per 1.01) as far as I can tell. What did you have in mind?

 

  On 2/25/2014 at 10:07 PM, z3z said:

 

Hmm, I'd have to know exactly which :D I've become a sissy-girl when it comes to graphics- and sound drivers after past experimentation. I feel like choosing the wrong driver leaves wounds on my computer that never heal.

Posted

Okay. Found the correct one now. I'd say it's about 50% chance it was installed correctly. It calls itself AMD catalyst install manager, doesn't pretend to be a *program*, it just installed, then did nothing. I decided to restart my computer for good measure, computer froze on startup (loaded forever), then forced it to restart, unplugged devices connected, started windows. I seem to remember I used to have access to some Catalyst control center back in the days, right clicking on the desktop. It's not showing up now, but it's installed under Programs.

 

Either way, the issue with rend2 persists.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...