Normal Mapping in the Goldsrc Created 3 years ago2020-11-22 09:53:15 UTC by FranticDreamer FranticDreamer

Created 3 years ago2020-11-22 09:53:15 UTC by FranticDreamer FranticDreamer

Posted 3 years ago2020-11-22 09:53:15 UTC Post #344922
Hello everyone!

I'm wondering, is there any modern approach to the normal maps in the Goldsrc engine?

I tried to find some solutions to the subject but I could find just one solution but it is so unnecessarily expensive hardware-wise and it is dependent on deprecated GL libraries that are hard to find (I couldn't) so I'm looking for better ways to do this.

For now, I'm trying to find a workaround with detail textures. But it isn't going so well. Here's an example of my "bright" solution:
Detailed (Right) - Plain (Left)
SolutionSolution
Team Psyskallar's Cry Of Fear and HL1 Mod Paranoia supports normal mapping if I'm not wrong. So it is possible, but how? If anyone has knowledge about this topic, please let me know. Thank you in advance. :)

Have a nice day.
FranticDreamer FranticDreamerR.I.P. Benny Harvey. Miss you big man. Gone but not forgotten.
Posted 3 years ago2020-11-22 11:39:12 UTC Post #344923
There are ways to do it for brushes. Detail textures aren't gonna cut it at all unless for a very specific lighting setup.
This article is a good start. However, instead of using Cg for the shading, you can use GLSL shaders.
Admer456 Admer456If it ain't broken, don't fox it!
Posted 3 years ago2020-11-22 12:25:35 UTC Post #344924
Thanks for your reply @admer456

I'm working on the SOHL source right now and some of the features are dependent on the Cg and I don't want to rewrite them. Also, I don't want to switch to the vanilla source because SOHL has some really useful features and I don't want to rewrite them too.

Is there a way to use Cg and GSLS together? If not, do you think its worth to increase build time for quality?
Manually BumpedManually Bumped
Manually Bumped In GameManually Bumped In Game
FranticDreamer FranticDreamerR.I.P. Benny Harvey. Miss you big man. Gone but not forgotten.
Posted 3 years ago2020-11-22 13:28:28 UTC Post #344925
Only the r_glow feature uses CG in SOHL, which you probably don't want or need.

If you're using SOHL 1.8 the functionality is disabled by default, you can simply delete glow.cpp from your project and then you can remove the references to cg.lib and cgGL.lib from your project and delete all the cg/gl stuff from your project and your mod won't need to include the cg/cgGL.dll files. For Spirit 1.4/1.5 it's the same, but you also need to remove or comment out these lines in cdll_int.cpp:
// Remove these lines and then delete glow.cpp!
// Also remove cg.lib and cgGL.lib from your linker settings, and remove cg.dll and cgGL.dll from your mod install.

// At the top of the file...
extern void InitScreenGlow(); // FragBait0 - Glow Effect
extern void RenderScreenGlow(); // FragBait0 - Glow Effect

// In HUD_VidInit...
if (CVAR_GET_FLOAT("r_glow") != 0)     //check the cvar for the glow is on.//AJH Modified to include glow mode (1&2)
    InitScreenGlow(); // glow effect --FragBait0

// In HUD_Redraw...
if (CVAR_GET_FLOAT("r_glow") != 0)     //check the cvar for the glow is on.//AJH Modified to include glow mode (1&2)
    RenderScreenGlow(); // glow effect --FragBait0
Penguinboy PenguinboyHaha, I died again!
Posted 3 years ago2020-11-22 13:55:50 UTC Post #344926
Neither bump mapping nor normal mapping will achieve the effect you want in those screenshots. You seem to want actual 3D extrusions, instead of the effect of bumpmapping.
You might wanna do some research about parallax mapping and relief mapping.

https://www.youtube.com/watch?v=5gorm90TXJM
Admer456 Admer456If it ain't broken, don't fox it!
Posted 3 years ago2020-11-22 17:38:38 UTC Post #344928
@Admer456
I just tried to simply create the thingy that I was using in the UE4/Unity/Godot/Source.

I was creating a high poly mesh, creating a normal map from it, and using the normal map on low poly mesh/BSP's texture to simulate shadows and lighting so without adding dents and bumps it would "simulate" them.

In screenshots, I tried to do the thing but I just ended up making some kind of "tessellation" effect that I make with a heightmap, not with a normal map. In those screenshots, I was trying to show I couldn't understand how to do normal maps with brushes, actually. :D

When I said "Increase build time for quality?" actually I was trying to refer to something like this

Sorry for unclearance and thanks for your help. :)
FranticDreamer FranticDreamerR.I.P. Benny Harvey. Miss you big man. Gone but not forgotten.
Posted 3 years ago2020-11-22 18:13:40 UTC Post #344930
She's turned the normal maps against us.
Archie ArchieGoodbye Moonmen
Posted 3 years ago2020-11-22 20:25:24 UTC Post #344934
So you were looking for the bumpmap effect after all.

Well, in that case, you'll need to make the normalmaps from scratch and do an extra rendering pass, multiplying the underlying pixels with the result of the normal map pass. If you rendered the map geometry as-is, you'd lose lightmaps and all that stuff, so yeah...
User posted image
Oh, right, also be careful when you render this, because if you render it after the entities have rendered, this will render over entities and it'll look weird.

It's pretty tricky to "get in the way" of GoldSRC's renderer and "insert" something before it renders something else.
As a COMPLETE alternative, you might as well rewrite the renderer entirely for 100% potential efficiency, but that takes a very long time.
Admer456 Admer456If it ain't broken, don't fox it!
You must be logged in to post a response.