News: Celebrating over 10 years serving the creative community

Author Topic: [GoldSrc] Shadows  (Read 460 times)

Копейка

  • Roach
  • *
  • Posts: 8
[GoldSrc] Shadows
« on: February 04, 2018, 07:22:06 PM »
Hi.

I swear I've seen at least two places where people explained re-enabling shadows in the HL1 source code, but I've lost them by now. At least one was in Spanish.

As a more far-away question, is there any way of fixing the code that's there to not cause so much stitching? I know that the Direct 3D rendering code doesn't produce as much of it but I can only test with OpenGL because MS drivers are proprietary and Linux doesn't like that very much.

Any help is appreciated.

JohnChronic

  • Half-Life 1.5 Team
  • Black Op
  • *
  • Posts: 352
  • Formerly Abyss 25
Re: [GoldSrc] Shadows
« Reply #1 on: February 04, 2018, 10:11:32 PM »
I wish there was a way to fix them, but I've only seen them enabled in a single unreleased mod. From what I saw, they were glitchy, clipped through level geometry, and it was really obvious that the shadows were faked. I feel like the tutorial used to be on VERC, although that's a long time ago.
Fairly pro texture artist.

Norman The Loli Pirate

  • Pit Drone
  • *****
  • Posts: 163
  • Los! Los! Los!
Re: [GoldSrc] Shadows
« Reply #2 on: February 05, 2018, 10:25:27 AM »
They were fixed in Sven Coop a few updates ago, can be enabled with r_shadows 1.
No idea how they fixed them but I can always ask.
Signatures are for nerds

Копейка

  • Roach
  • *
  • Posts: 8
Re: [GoldSrc] Shadows
« Reply #3 on: February 05, 2018, 11:10:32 AM »
I swear it was just a couple lines of code, but what it was I don't remember.

Копейка

  • Roach
  • *
  • Posts: 8
Re: [GoldSrc] Shadows
« Reply #4 on: February 05, 2018, 04:08:59 PM »
Did some digging and found something, unfortunately it is indeed in Spanish. Google Translate time for me. http://www.hl2spain.com/foro/index.php?showtopic=12143
« Last Edit: February 05, 2018, 04:10:30 PM by Копейка »

JohnChronic

  • Half-Life 1.5 Team
  • Black Op
  • *
  • Posts: 352
  • Formerly Abyss 25
Re: [GoldSrc] Shadows
« Reply #5 on: February 06, 2018, 08:43:19 AM »
You may be able to cut out the middle man here. SysOp is/was fairly active in the HL mod scene, you might still be able to get in touch with with him via his moddb page or on various forums. He has likely learned a lot since that post from 2006.

Edit: also, he's a polyglot, he speaks english too
« Last Edit: February 06, 2018, 08:46:05 AM by JohnChronic »
Fairly pro texture artist.

GeckonCZ

  • New Member
  • Posts: 1
Re: [GoldSrc] Shadows
« Reply #6 on: February 07, 2018, 08:42:05 PM »
Looks like the code is still in the engine, they just disabled the r_shadows cvar. So you should be able to call the function from your studio model renderer.

Something like this should do the trick: http://hl-improvement.com/forums/index.php?topic=3527.50;wap2

It's not my code and I'm not sure why did they go for inline assembler there, you can certainly find a cleaner way. It should produce the old ugly flickery shadows we all love and hate. If you want to get somewhat better results, you should use at least a stencil buffer... or some other, more sophisticated, method.

I have noticed that Xash has stencil shadows. Check GL_StudioDrawShadow() and  R_StudioDrawPlanarShadow() in gl_studio.c. But I have no idea if it actually works... so you better check that out first.

Копейка

  • Roach
  • *
  • Posts: 8
Re: [GoldSrc] Shadows
« Reply #7 on: February 08, 2018, 04:22:50 AM »
Thanks for the info, GeckonCZ.

JohnChronic

  • Half-Life 1.5 Team
  • Black Op
  • *
  • Posts: 352
  • Formerly Abyss 25
Re: [GoldSrc] Shadows
« Reply #8 on: February 08, 2018, 05:47:02 AM »
If you're a real badass with code, you could try modifying the renderer with an opengl32.dll, you could implement almost any method that way.

Example, deferred rendering in Goldsrc using injected code:

https://www.reddit.com/r/pcgaming/comments/36zbh9/modified_goldsource_engine_with_deferred_shading/
Fairly pro texture artist.