Jump to content
The Dark Mod Forums

Recommended Posts

Posted

I want 2.07 to support custom GLSL shaders, even if experimental.

For now it will be of limited use due to interaction shaders being locked to standard only (for reasons of compatibility with existing missions).

One particular place where we could apply a custom shader could be the skybox.

We have standard sky materials with multiple stages, that cause massive fillrate overdraw. If we could reduce those to a single material, the performance be could significantly improved.

Another possible application is complex water surface, but that's more complicated to achieve.

 

I am looking for a mapper who will be working on a test/demo map with a skybox material that combines multiple translucent textures. The old-fashioned way would be to split each texture in a separate material stage while this time they will be all fed to a customer shader in one material stage.

 

Ideas on going beyond the simple blending are welcome.

 

Any volunteers?

  • Like 4
Posted

Sure, I'll volunteer. I've been slacking on participation in the community so this should be nice. I have intermediate - but not expert - knowledge of skyboxes and very little knowledge of shaders, but I know enough to be able to type in a texture map into a tex shader input field in the .mtr, lol.

 

Shoot me a PM if you want, I'll be available this Fri and Sat and free on Sun and Mon.

My FMs: The King of Diamonds (2016) | Visit my Mapbook thread sometimes! | Read my tutorial on Image-Based Lighting Workflows for TDM!

 

 

Posted

Nice. I wonder if this feature could help with our fog + skyboxes issues? Will be good to see what you guys come up with.

  • Like 1
Posted

Sure, I'll volunteer. I've been slacking on participation in the community so this should be nice. I have intermediate - but not expert - knowledge of skyboxes and very little knowledge of shaders, but I know enough to be able to type in a texture map into a tex shader input field in the .mtr, lol.

 

Shoot me a PM if you want, I'll be available this Fri and Sat and free on Sun and Mon.

Would you upload or attach a simple .map and an .mtr where the material is defined.

Then I add a shader and link it to the material.

Posted

Alright, here are the map and material file. I'm working off the root, so just place them in <root>/maps/skybox_demo and <root>/materials respectively, no need for an FM folder for two loose files. I've put in the tdm_foggy skybox prefab, a fairly standard skybox, then replaced the sky dome inside it with one textured with the "textures/darkmod/nature/skybox/glsl_shader_demo" custom material. The contents of said material are a copy of the twinkle_stars material, you can empty it and set up the shader program inside as you want.

 

The map has a foglight and a transparent alpha-test decal, so you can visually see if there are any problems with those.

 

skybox_demo.map.txt

skybox_demo.mtr.txt

  • Like 1

My FMs: The King of Diamonds (2016) | Visit my Mapbook thread sometimes! | Read my tutorial on Image-Based Lighting Workflows for TDM!

 

 

Posted

I'm starting with this and will try a simple shader next

textures/darkmod/nature/skybox/glsl_shader_demo
{
	translucent
	diffusemap textures/darkmod/nature/skybox/starry1_stars
	{
		blend add
		program	skybox_glsl

		fragmentMap		0		textures/darkmod/nature/skybox/starry1_clouds
		fragmentMap		1		textures/darkmod/nature/skybox/starry1_stars
		fragmentMap		2		textures/darkmod/nature/skybox/thunderclouds
	}
}
Posted

WIP. Svn rev 7702.

textures/darkmod/nature/skybox/glsl_shader_demo
{
	translucent
	diffusemap textures/darkmod/nature/skybox/starry1_stars
	{
		blend add
		program	skybox

		fragmentMap		0		textures/darkmod/nature/skybox/starry1_clouds
		fragmentMap		1		textures/darkmod/nature/skybox/starry1_stars
		fragmentMap		2		textures/darkmod/nature/skybox/thunderclouds
	}
}
Posted (edited)

 

WIP. Svn rev 7702.

 

As a heads-up, if you want feedback on a particular build of the shader, you're going to have to be attaching the glprog here too, as I don't have access to SVN. e: and I should know if there are any SVN-specific dependencies that would make it look wrong on stock 2.06, I assume not.

Edited by Spooks

My FMs: The King of Diamonds (2016) | Visit my Mapbook thread sometimes! | Read my tutorial on Image-Based Lighting Workflows for TDM!

 

 

Posted

Here is a package.

 

https://drive.google.com/open?id=1-_d3KRXrmhJtKoVoXzf4JEk9vQbC5hzg

 

I am reluctant to upload this to Moddb until the rendering scissor bug that is cutting off the tops

of helmets is fixed.

 

post-3763-0-57233600-1537585164_thumb.jpg

 

It doesn't happen all the time but it's pretty glaring when it happens.

Please visit TDM's IndieDB site and help promote the mod:

 

http://www.indiedb.com/mods/the-dark-mod

 

(Yeah, shameless promotion... but traffic is traffic folks...)

Posted

Spectrum doesn't seem to do much, commenting it out still doesn't make light interact, that might be due to blend add but I don't remember if that's how it worked. Getting ahead of myself, I was unable to make it show up with the .exes from the binaries provided above, but the notools.exe did it, so yes, okay.

 

Initial tests: some materials cannot be loaded in the shader, I checked the example materials and a cobweb mat that worked, they all had the translucent keyword, is this the determinant? Transparent decal materials with alpha test did not work, neither did regular brick textures. But then, a glass crack decal with 'translucent' did not work, yet graffiti/cockwit worked.

 

Any uses for the flags in the vertexParm line? The first value seems to do something but it's very hard to tell what.

 

The images seem pre-programmed to scroll, and I see each stage has its own scroll direction and speed, one of which being static. It might be useful to give some kind of control to that via the vertex parameters. What about the opacity?

 

Could there be more than 3 fragment maps? Is that a hard limit?

 

---

 

I initially thought straight up image maps would get plugged into the shader, but materials is way better for multiple reasons. Why no light interaction, though? If materials are being blended, there might be interesting effects that may be achieved with normal maps, like clouds reacting to moonlight inside the skybox. Would it be hard to do inside the shader?

 

Related to that, you said multi-stage materials caused a lot of overdraw, but this shader still displays mats instead of image maps. Does the simple fact that all of the materials are rendered through a shader (inside a single material) nullify that? I don't particularly need to know why, but rather if it is truly more efficient.

My FMs: The King of Diamonds (2016) | Visit my Mapbook thread sometimes! | Read my tutorial on Image-Based Lighting Workflows for TDM!

 

 

Posted

Spectrum doesn't seem to do much, commenting it out still doesn't make light interact, that might be due to blend add but I don't remember if that's how it worked. Getting ahead of myself, I was unable to make it show up with the .exes from the binaries provided above, but the notools.exe did it, so yes, okay.

 

Initial tests: some materials cannot be loaded in the shader, I checked the example materials and a cobweb mat that worked, they all had the translucent keyword, is this the determinant? Transparent decal materials with alpha test did not work, neither did regular brick textures. But then, a glass crack decal with 'translucent' did not work, yet graffiti/cockwit worked.

 

Any uses for the flags in the vertexParm line? The first value seems to do something but it's very hard to tell what.

 

The images seem pre-programmed to scroll, and I see each stage has its own scroll direction and speed, one of which being static. It might be useful to give some kind of control to that via the vertex parameters. What about the opacity?

 

Could there be more than 3 fragment maps? Is that a hard limit?

 

---

 

I initially thought straight up image maps would get plugged into the shader, but materials is way better for multiple reasons. Why no light interaction, though? If materials are being blended, there might be interesting effects that may be achieved with normal maps, like clouds reacting to moonlight inside the skybox. Would it be hard to do inside the shader?

 

Related to that, you said multi-stage materials caused a lot of overdraw, but this shader still displays mats instead of image maps. Does the simple fact that all of the materials are rendered through a shader (inside a single material) nullify that? I don't particularly need to know why, but rather if it is truly more efficient.

Sorry, I didn't understand some parts of your post.

 

The material load errors in the console aren't related or caused by custom GLSL, no?

 

The vertex parm there passes current time to shader that it uses for scrolling. You can pass anything else, as long as it's supported by the material parser.

 

Texture limit is 8.

 

You can use the material with interactions if you want. But any light interaction goes out of scope of this thread.

You can pass any texture to the shader, including normal maps. What the shader does with it, simulating interactions or whatever, is the mapper's choice. You can control opacity and everything else a shader can do.

 

You would have to elaborate on the last paragraph, I totally don't get it.

Posted

The material load errors are when I try to replace the example materials in the fragmentMap fields with other ones from the mod. Some refuse to load, you can see it visually as well as in the console. I'm saying the shader doesn't display certain materials when they're used in it.

 

You say controlling opacity, simulating interactions, etc. is the mapper's choice? How is it the mapper's choice, are they to edit the shader themselves?

 

Yes, pretty much what HMart said.

My FMs: The King of Diamonds (2016) | Visit my Mapbook thread sometimes! | Read my tutorial on Image-Based Lighting Workflows for TDM!

 

 

Posted

Umm

Do you guys confuse materials with textures?

The fragmentMap keyword takes a name of a texture (i.e. a .tga, .jpg, .dds, etc). Not a material name.

		fragmentMap		0		textures/darkmod/nature/skybox/starry1_clouds

The starry1_clouds here is an actual .tga.

So the shader can't be "calling many materials".

 

 

You say controlling opacity, simulating interactions, etc. is the mapper's choice? How is it the mapper's choice, are they to edit the shader themselves?

Exactly. What some mappers did with ARB shaders before.

Posted

Yeah, I'm sorry. I checked and it loads image maps. It's just that the material and diffuse map names are often the same names, and for some reason I misremembered image maps being declared with their file extensions in the material files, which is why I made the assumption. Shows how long I've been away from editing. The console log messages even say "couldn't load image" but I didn't pay attention.

 

Apart from the blunder, the potential flexibility still bothers me. How much could an end-user (a mapper as opposed to a coder) affect the properties of the shader through editing the properties in the material file?

My FMs: The King of Diamonds (2016) | Visit my Mapbook thread sometimes! | Read my tutorial on Image-Based Lighting Workflows for TDM!

 

 

Posted

Apart from the blunder, the potential flexibility still bothers me. How much could an end-user (a mapper as opposed to a coder) affect the properties of the shader through editing the properties in the material file?

You can feed the input data through vertexParms.

All actual operation is done inside the shader and you (mapper) have full control on what happens there.

Posted

Umm

 

Do you guys confuse materials with textures?

 

The fragmentMap keyword takes a name of a texture (i.e. a .tga, .jpg, .dds, etc). Not a material name.

 

:D:P No not normally, but believe it or not, in all honesty I did knew those fragmentMaps calls were texture calls, I've used ARB/GLSL shaders before, i was just telling you what he asked has you didn't understood the question.

 

To be fair to Spooks, making materials that call a shader is not something that a person working with idtech 4 do all the time so anyone could make his mistake. :)

 

Btw Spooks about shader flexibility, depending on the shader it can have plenty of flexibility, you obviously can't modify the shader code itself through a material call, but by changing the input, you change the outcome of the shader, so with one shader you can have many materials with different looks and behaviors. For example the heatHaze shader, it's used to make glass, water, heat waves for explosions and fire, etc.

Posted

That's the point, raise of hands, any currently active mappers who can fluently code in GLSL. My worry is that nobody will actually edit the shader and will use it stock out of the box. I know the point of this particular one is just to ship something experimental as a proof of concept for 2.07, but I'm warning you that no one will go the extra mile, or ought to for that matter if their time would be better spent on level layout and asset creation.

My FMs: The King of Diamonds (2016) | Visit my Mapbook thread sometimes! | Read my tutorial on Image-Based Lighting Workflows for TDM!

 

 

Posted

Spooks I wouldn't worry about that, like i said a single shader can have many different outcomes, depending on the inputs giving, so it doesn't matter if mission makers don't write new ones.

 

But i'm sure someone will, just having the ability to write or use custom shaders is very good, especially now in GLSL because is like coding in C and there's plenty of examples on the internet. This opens the door to many new possibilities just look to this site shader Toy.

Posted

The important thing is to give mappers the choice and the tool. Now when someone needs this they can use it instantly, without waiting a year till the next version.

  • Like 3

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


  • Recent Status Updates

    • jivo

      I just uploaded a new version of the Visible Player Hands mod. It's been updated for TDM 2.13 and has new animations. Check out the post if you're interested!
      · 0 replies
    • datiswous

      I moved from Manjaro Linux (rolling release) to Linux Mint (LTS). One of the reasons was that I found the updates a bit too often and long. But now on Mint I get updates every day, although they're usually small updates.
      · 3 replies
    • JackFarmer

      "Hidden Hands: Vitalic Fever" - new update available including subtitles & compressed briefing video (thanks to @datiswous) and several fixes.
      · 0 replies
    • Wolfmond

      🇬🇧

      2025-04-20
      I'd like to track my level design progress a bit more often now, so I'm using the feed in my profile here.
      I've been working intensively on Springheel's YouTube course over the past few days. I'm currently up to lesson 8. There is so much information that needs to be processed and practiced. 
      I have started to create my own house. As I don't have the imagination to create a good floor plan, I grabbed a floor plan generator from Watabou and experimented with it. I chose a floor plan that I will modify slightly, but at least I now have an initial idea. 
      I used two guards as a measuring tape: The rooms are two guards high. It turned out that I can simply double the number of boxes in DarkRadiant in grid size 8 that are drawn in the floor plan. 
      I practiced the simplest things on the floor plan first. Drawing walls, cutting walls, inserting doors, cutting out frames, creating VisPortals, furnishing rooms.
      I have had my first success in creating a book. Creating a book was easier than I thought. I have a few ideas with books. The level I'm creating will be more or less a chill level, just for me, where I'll try out a few things. I don't have an idea for my own mission yet. I want to start small first.
      For the cellar, I wanted to have a second entrance, which should be on the outside. I'm fascinated by these basement doors from the USA, I think they're called Bilco basement doors. They are very unusual in Germany, but this type of access is sometimes used for deliveries to restaurants etc., where barrels can be rolled or lifted into the cellar. 
      I used two Hatch Doors, but they got completely disoriented after turning. I have since got them reasonably tamed. It's not perfect, but it's acceptable. 
      In the cellar today I experimented with a trap door that leads to a shaft system. The rooms aren't practically finished yet, but I want to continue working on the floor plan for now. I'll be starting on the upper floor very soon.

      __________________________________________________________________________________
      🇩🇪

      2025-04-20

      Ich möchte nun mal öfters ein bisschen meinen Werdegang beim Leveldesign tracken, dazu nutze ich hier den Feed in meinem Profil.
      Ich habe mich in den vergangenen Tagen intensiv mit dem Youtube-Kurs von Springheel beschäftigt. Aktuell bin ich bis zu Lektion 8 gekommen. Das sind so viele Informationen, die erstmal verarbeitet werden wollen und trainiert werden wollen. 

      Ich habe mich daran gemacht, ein eigenes Haus zu erstellen. Da mir die Fantasie fehlt, einen guten Raumplan zu erstellen, habe ich mir einen Grundrissgenerator von Watabou geschnappt und damit experimentiert. Ich habe mich für einen Grundriss entschieden, den ich noch leicht abwandeln werde, aber zumindest habe ich nun eine erste Idee. 

      Als Maßband habe ich zwei Wächter genommen: Die Räume sind zwei Wächter hoch. Es hat sich herausgestellt, dass ich in DarkRadiant in Gittergröße 8 einfach die doppelte Anzahl an Kästchen übernehmen kann, die im Grundriss eingezeichnet sind. 

      Ich habe bei dem Grundriss erstmal die einfachsten Sachen geübt. Wände ziehen, Wände zerschneiden, Türen einsetzen, Zargen herausschneiden, VisPortals erstellen, Räume einrichten.

      Ich habe erste Erfolge mit einem Buch gehabt. Das Erstellen eines Buchs ging leichter als gedacht. Ich habe ein paar Ideen mit Bücher. Das Level, das ich gerade erstelle, wird mehr oder weniger ein Chill-Level, einfach nur für mich, bei dem ich ein paar Sachen ausprobieren werde. Ich habe noch keine Idee für eine eigene Mission. Ich möchte erst einmal klein anfangen.

      Beim Keller wollte ich gerne einen zweiten Zugang haben, der sich außen befinden soll. Mich faszinieren diese Kellertüren aus den USA, Bilco basement doors heißen die, glaube ich. Diese sind in Deutschland sehr unüblich, diese Art von Zugängen gibt es aber manchmal zur Anlieferung bei Restaurants etc., wo Fässer dann in den Keller gerollt oder gehoben werden können. 
      Ich habe zwei Hatch Doors verwendet, die allerdings nach dem Drehen vollkommen aus dem Ruder liefen. Inzwischen habe ich sie einigermaßen gebändigt bekommen. Es ist nicht perfekt, aber annehmbar. 
      Im Keller habe ich heute mit einer Falltür experimentiert, die zu einem Schachtsystem führt. Die Räume sind noch quasi nicht eingerichtet, aber ich möchte erstmal am Grundriss weiterarbeiten. In Kürze fange ich das Obergeschoss an.



      · 2 replies
    • JackFarmer

      On a lighter note, thanks to my cat-like reflexes, my superior puzzle skills and my perfect memory, I was able to beat the remastered version of "Tomb Raider: The Last Revelation" in a new superhuman record time of 23 h : 35 m, worship me!
      · 5 replies
×
×
  • Create New...