Jump to content

Rend2 - A Modern Renderer


Xycaleth

Recommended Posts

Posted

How are the Tangents and biNormals being calcuated? Is it MCT Space like Unreal or more like Unity? Just asking for Substance Painter purposes

Posted

Ah, rend2 has its own tangent space calculations. Thought on adding mikkt-space, but for now you simply cant get the right tangents and bi-tangents, sry

ChalklYne likes this
  • 3 months later...
Posted

Having trouble loading up rend2 in mp

--- ambient sound initialization ---
Sound memory manager started
VM_Create: uix86.dll failed!
VM_CreateLegacy: uix86.dll succeeded
^3menu file not found: ui/mb_menus.txt, using default
--- Common Initialization Complete ---
Winsock Initialized
Hostname: Daan-PC
IP: 192.168.178.18
Opening IP socket: localhost:29070
]cl_renderer rd-rend2; vid_restart
cl_renderer will be changed upon restarting.
----- Initializing Renderer ----
Trying to load "rd-rend2_x86.dll" from "C:\GOG Games\Star Wars Jedi Knight - Jedi Academy\GameData"...
Mismatched REF_API_VERSION: expected 8, got 9
Closing SDL audio device...
SDL audio device shut down.
Couldn't initialize refresh

Can you guys help me?

Posted

Having trouble loading up rend2 in mp

----- Initializing Renderer ----
Trying to load "rd-rend2_x86.dll" from "C:\GOG Games\Star Wars Jedi Knight - Jedi Academy\GameData"...
Mismatched REF_API_VERSION: expected 8, got 9

Can you guys help me?

 

This message tells you, that the game tried to load a renderer with the API Version 9, but the libary you set is designed for the API Version 8. This means, the latest rend2 version is not compatible with newer versions of OpenJK. Not sure which version of OpenJK will work, but you need to take an older version of it to make rend2 work. There is currently noone who has time updating rend2. Sorry.

Posted

You need to run the openJK build that has rend2 included. Unfortunately, you can't just move the rend2 dll over to any openJK build and expect it to work.

  • 2 weeks later...
Posted

I can give it a go tomorrow. Does it support PBR materials?

It uses diffuse and specular with roughness (maybe still gloss?) in the alpha channel afaik. So yea. It does support pbr materials. Though ambient occlusion is not supported.

 

@@Xycaleth tried the build with an OpenJK version with the newer api. Works fine for me.

  • 3 weeks later...
Posted

For this you need to understand how normal mapping actually works. It fakes the normal direction of the surface and darkens the areas that point kind of the same direction as the light. Problem with that is, that you have to know where the light is, to compair the normal vector and the light incident vector. The real problem in this case is that all the surfaces lit by static lights only store the information of how much light there is and which color shines on it. This information is stored in the .bsp as a lightmap (actually several ones). You have no information about the incident light vector. This results in normal mapping that is only visible with (real) dynamic lights like saber and muzzleflashes.

 

You have multiple options.

First one: Tell the shader before compilation that there is a normal map and bake the occlusion information in the lightmaps. Pro: Easy to work out, you find a tutorial in the tutorials section about it. Con: You actually loose the advantage of very crisp normal mapping for static lights, because lightmaps have a low resolution. (you could krank it up in GTKRadiant, but you will loose lots of performance overall)

Second one: Use fxRunners. There was a map Scizo made for rend2 and he added dynamic ligths via fxRunners. I have no idea how this works, I guess you can find the map 2 or 3 pages prior this one. He included his map file (also all his shaders, textures and so on, so this is worth a look for you).

Third one: Use parallax mapping. Example also in the map made by Scizo.

Last one (not a real one I guess): Fix deluxe mapping in the rend2 branch and simply compile your map with -deluxe in the lighting stage. (this technique is not perfect, but it should suffice for most cases) GL2 can use deluxemapping, ioq3 too.

 

Hope this helps.

 

Thank you SomaZ.

 

I tried fxRunners, I like it.

Skulls_test_Del.png

But fxRunners shine through objects and do not give shadows. So I need to bake bump in the lightmap. I tried to do this, but unfortunately I did not succeed. Tell me what I do wrong.

 

 

assets1.pk3\shaders\Deleterock.shader

 

Shader:

 

textures/Deleterock/Deleterockd

{

     q3map_normalimage textures/Deleterock/Deleterocknormal.tga

     qer_editorimage textures/Deleterock/Deleterockd

     q3map_lightmapsamplesize 1x1

{

     map $lightmap

     rgbGen identity

}

{

     map textures/Deleterock/Deleterockd

     blendFunc GL_DST_COLOR GL_ZERO

}

}

 

 

assets1.pk3\textures\Deleterock

 

Deleterockd.jpg

...

Deleterocknormal.tga

...

 

In Gtkradiant:

worldspawn:

_lightmapscale 0.2

classname worldspawn

 

 

After compilation, I go into the game and I do not see any changes. Please tell me what I do wrong

r_lightmap 1

Skull.png

 

------

UPD.

 

I solved the problem. :) (Shaderlist.txt)

lightmap.png

Box6.png

SomaZ, Smoo, Wasa and 1 other like this
  • 2 months later...
Posted

Hello.

I can not figure out Cubemap.
I am very interested in the environment reflections for water, metal surfaces, smooth dielectric surfaces ... How to get reflection?

Please tell me how to correctly place and configure Cubemap? .. (What programs are needed for this, besides Gtkradiant?)

Should I do "Cubemap shot"? If so, how to do it?

Are there any other ways to get eNvironment reflections? Cubemapped skybox shader, cubemapped water shader? ..

Please create a small test map (1 floor, 1 wall, Skybox and cubemap), so I can check if the cubemap works in the game. (If you already have a map created with Cubemap, please provide a download link.)

Posted

Ok here is a short form tutorial.

Mapping and compiling

 

 

Ok, first of all, mapping and compiling is nearly untouched by the new rendering engines. There are only a very few things you might want to consider. If you want to have crisp shadows coming from the sun, remove the sun in your sky in the shader files (maybe just comment them out) and compile the map without the sun. You have to add a new shader for the sun, but I'll explain it in the material shader part.

Second thing you want to do is placing cubemaps. You need to place new entities that are named "misc_cubemap" and give them a field "radius". This radius is not drawn in GTK radiant so you need to look at the rulers.

It should look something like this after placing them (without the radiuses):

demo1.png?w=494&h=203

There is nothing special to say about compiling. Compile as usual

Edit: Ups, forgot one could add -deluxe for the light stage of compiling. This is partially implemented in GL2 :P

 

 

materials and shaders

 

 

To support the old renderer, the shader files don't need to be changed, but you need to write some new shader files. To start with you can simply copy your shader file and rename the extension to ".mtr" instead of ".shader".

example of a shader for brushes:

 

 

textures/test/test_wall_d
{
	{
        map textures/test/test_wall_d
	}
	{
	stage normalmap
	map textures/test/test_wall_n
        }
	{
        stage specularmap
        map textures/test/test_wall_s
	}
        {
        map $lightmap
        blendfunc GL_DST_COLOR GL_ZERO
    }
}

 

example of a shader for models an playermodels:

 

models/weapons2/clonedummy/helmet
{
cull	disable
    {
        map models/weapons2/clonedummy/helmet
        rgbGen lightingDiffuse
    }
    {
	stage normalmap
	map models/weapons2/clonedummy/Helmet_normal
    }
    {
	stage specularmap
        map models/weapons2/clonedummy/helmet_Specular
    }
}

 

example for a sky shader

 

textures/skies/rend2
{
	surfaceparm	sky
	surfaceparm	noimpact
	surfaceparm	nomarks
	surfaceparm nolightmap
	notc
	//q3gl2_sun <red> <green> <blue> <intensity> <degrees> <elevation> <shadowScale>
	q3gl2_sun 240 238 200 500 195 35 0.5 0.2

        //q3gl2_tonemap <toneMapMin> <toneMapAvg> <toneMapMax> <autoExposureMin> <autoExposureMax>
	
	skyParms	textures/skies/desert 512 -
}

 

Can't think of anything else right now.

 

 

For more information, go to: https://github.com/ioquake/ioq3/blob/master/opengl2-readme.md

Bad Dancer likes this
Posted

 

Ok here is a short form tutorial.

Mapping and compiling

 

 

Ok, first of all, mapping and compiling is nearly untouched by the new rendering engines. There are only a very few things you might want to consider. If you want to have crisp shadows coming from the sun, remove the sun in your sky in the shader files (maybe just comment them out) and compile the map without the sun. You have to add a new shader for the sun, but I'll explain it in the material shader part.

Second thing you want to do is placing cubemaps. You need to place new entities that are named "misc_cubemap" and give them a field "radius". This radius is not drawn in GTK radiant so you need to look at the rulers.

It should look something like this after placing them (without the radiuses):

demo1.png?w=494&h=203

There is nothing special to say about compiling. Compile as usual

Edit: Ups, forgot one could add -deluxe for the light stage of compiling. This is partially implemented in GL2 :P

 

 

materials and shaders

 

 

To support the old renderer, the shader files don't need to be changed, but you need to write some new shader files. To start with you can simply copy your shader file and rename the extension to ".mtr" instead of ".shader".

example of a shader for brushes:

 

 

textures/test/test_wall_d
{
	{
        map textures/test/test_wall_d
	}
	{
	stage normalmap
	map textures/test/test_wall_n
        }
	{
        stage specularmap
        map textures/test/test_wall_s
	}
        {
        map $lightmap
        blendfunc GL_DST_COLOR GL_ZERO
    }
}

 

example of a shader for models an playermodels:

 

models/weapons2/clonedummy/helmet
{
cull	disable
    {
        map models/weapons2/clonedummy/helmet
        rgbGen lightingDiffuse
    }
    {
	stage normalmap
	map models/weapons2/clonedummy/Helmet_normal
    }
    {
	stage specularmap
        map models/weapons2/clonedummy/helmet_Specular
    }
}

 

example for a sky shader

 

textures/skies/rend2
{
	surfaceparm	sky
	surfaceparm	noimpact
	surfaceparm	nomarks
	surfaceparm nolightmap
	notc
	//q3gl2_sun <red> <green> <blue> <intensity> <degrees> <elevation> <shadowScale>
	q3gl2_sun 240 238 200 500 195 35 0.5 0.2

        //q3gl2_tonemap <toneMapMin> <toneMapAvg> <toneMapMax> <autoExposureMin> <autoExposureMax>
	
	skyParms	textures/skies/desert 512 -
}

 

Can't think of anything else right now.

 

 

For more information, go to: https://github.com/ioquake/ioq3/blob/master/opengl2-readme.md

 

 

Thank you, SomaZ.

 

(1) - I did not find misc_cubemap.

image.png

(2) - I created a light entity.

image.png

(3) - After that I clicked "N". Сlassname light changed to classname misc_cubemap. (In the upper right corner is my sketch, I closed the blank space in the image.) :)

image.png

(4) - I removed the sun from the sky shader.

(5) - Q3map2build settings.

 

4-5.png

 

(6) - Compiling.

(7) - After completing the compilation, the sun has reappeared.

 

6-7a.png

 

(8) - Devmap a1.

image.png

(9) - Cl_render rd-rend2; vid_restart. The sunny side of the wall. (No environment reflections. Only fx runners and sun.)

image.png

(10) - The shadow side of the wall. (No environment reflections. Only fx runners and sun.)

 

image.png

 

(11) - I did everything the same, from 1 to 10, only with other textures. (No environment reflections. Only fx runners and sun.)

 

image.png

 

(12) - The shadow side of the wall. (No environment reflections. Only fx runners and sun.) :(

 

image.png

 

 

r_normalmapping 1

r_specularmapping 1

r_deluxemapping 1

r_sunlightmode 2

r_hdr 0

r_gennormalmaps 1

r_basenormalx 2.0

r_basenormaly 2.0

r_ssao 0

r_dlightmode 1

Smoo and dg1995 like this
Posted

R_cubemapping 1? I guess thats the needed cvar.

 

Edit: why have you disabled r_hdr?

I forgot to write. That's right, r_cubemapping 1.

 

Regarding r_hdr ... When r_hdr 1, r_cubemapping 1, here's what happens:

ERROR: GL_State: invalid src blend state bits

********************

RE_Shutdown (0)

recursive error after: GL_State: invalid src blend state bits

 

Can you suggest something to me?

 

P.S. (1)-(7) Did I do everything right? Were there any mistakes?

 

P.P.S.

I have one more question. R_sunlightmode 1. There is a shadow, but there is no reflection of the sun in the metal.

r_sunlightmode_1-c.png

R_sunlightmode 2 - The reflection of the sun.

image.png

 

Smoo likes this
Posted

hm, thats crazy. could you pls try setting r_ignoreDstAlpha 0 and try again using hdr rendering? Could you also pm me your map? best with shaders and textures. It's easier to find mapping issues this way, though it looks like you did fine on first glance.

 

Sry to be so short on explanations, haven't been home some days and I'm writing all of this with my phone.

Bad Dancer likes this
Posted

Your advice (r_ignoreDstAlpha 0) helped me get rid of another problem (in the game menu).

Sorry, I provided you with incorrect information.
I was wrong. When r_hdr 1, r_cubemapping 1, here's what happens:
1
1_R_cubemap_1_and_R_HDR_1.png
2
2_R_cubemap_1_and_R_HDR_1.png


Regarding r_ignoreDstAlpha 0 ...
When I opened the game with rend2, the game showed me an ERROR.
--------------------------
ERROR: GL_State: invalid src blend state bits
********************
RE_Shutdown (0)
recursive error after: GL_State: invalid src blend state bits
--------------------------
I had to run the game with cl_renderer rd-vanilla, after that I wrote devmap "mapname", and only then I entered cl_renderer rd-rend2 ... Before each output in the game menu, I had to change the renderer on (rd-vanilla). When I entered r_ignoreDstAlpha 0, crashes stopped. Thank you.

What does r_ignoreDstAlpha affect?

Posted

There are blends that can use the alpha value of the underlaying objects. Problem was that some graphic cards or the driver, not Sure about this, had problems with those blend states. Therefore this cvar exists. It simply replaces this blend Mode with another one to prevent problems with some cards. There was an error in this code though. I fixed it in newer versions of rend2. You should update your rend2 to the current build. Maybe this also fixes your error with cubemapping, havent had the time yet to check your map.

 

Edit: Well it works fine on my machine with latest rend2 build. Can you send me your complete config?

 

 

p5C8dbH.jpg

 

 

Merek, dg1995, Bad Dancer and 1 other like this
Posted

First post:

 

Coding
For coding, I would recommend you know computer graphics well enough to implement some basic algorithms on their own (e.g. shadow maps, some post-processing effects). If you are able to do this in Direct3D, then learning OpenGL should be reasonably easy. Unfortunately I don't have the time or inclination to teach graphics to every coder that comes my way. If you think you are able to help, you can find the latest rend2 code in my fork of OpenJK:

https://github.com/xycaleth/OpenJK/

All rend2 work is being done in the rend2 branch.
Posted

A shame that so many up and coming enhancements/mods for JK3 I see like this almost always focus on MP only and treats SP as an after thought... extremely rare that SP is held to the same level (at least from what I've seen) even though SP offers, arguably, more diverse variety and possibilities compared to online and less engine/gameplay restrictions overall (different character/combat animations, just to name one example) except for the fact that its not online..... obviously. I get that its because of MP that this game's community is still even alive today... but still.  :/  Well the screenshots were nice to look at I guess, lol!

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...