Jump to content
The Dark Mod Forums

Recommended Posts

Posted

So yeah as by the title you can gather I'm attempting to gather good shader and MTR info on completing good water. What's paining me most is that I can't get even relatively close to good reflections and it's bugging the hell outta me. I've got a pretty snazzy material that can provide worthy generic reflection (from say a cubemap of the skybox) but that can't constitute the water line of shore, docks and buildings.

 

This brings me to the planar reflections of a stock material I found called "textures/water_source/cave_water_reflective_01"

{
qer_editorimage textures/glass/glass1
translucent
noshadows
nonsolid


{
blend blend
mirrorRenderMap 1024 1024
program fresnel.vfp
vertexParm 0 0.6
fragmentMap 0 _scratch
}
}

This simply doesn't work if you're using a normal skybox, as the mirrorRenderMap stage doesn't recognize the skybox projection and reflects a backdrop relative to seeing a leak. However what it will do is achieve the water line reflections I seek. At the mercy of recasting and rendering every single shadow in the map (yikes!). :o

 

Now I'm not accustomed to the workings of the vfp but is it possible to condense/create a simpler one that doesn't relist shadows twice? I only need the silhouette that the planar reflection can provide as it wont be used wholesale as the primary effect. My goal is to layer this reflective pass (to gather waterline reflection data) and then fill in the blanks of a skybox backdrop manually by layering in a cubemap blend. Then what you'd have is proper world reflections, decent sky and cut the additional shadow cost. In the end it would be some fancy water, without the fancy overhead budget. I'm no expert to these materials so if anybody has a simpler method to getting that water line, I'm all ears.

 

Modeler galore & co-authors literally everything

 

 

Posted

I wish I was more helpful here, but apart from the skybox issue, I remember a discussion in which someone mentioned the fresnel image program doesn't work like an actual fresnel, so that might also be a source of problems. I wanted to use fresnel program for a frob outline, as you typically do in other engines, but I couldn't get it to work.

Posted

I don't think it is possible to have a dynamically-rendered reflection that doesn't increase shadow rendering, because the reflection is effectively a completely separate render from a different perspective (i.e. the other side of the plane looking back towards the camera). Assuming you want correctly-rendered shadows in the reflection, it is going to be necessary to render the shadows from this perspective, and there is no way to re-use the shadows from the main render because it's a completely different camera setup with a different field of view.

 

The only options, as far as I know, are the fully-dynamic reflection which has a performance hit due to the second render, or use a pre-rendered cubemap which is much faster but does not respond dynamically to changes in the scene.

Posted

Well from what I'm gathering the dynamic reflection is re-rendering the scene. I guess what I'm unsure about is how much of this re-rendering is shader dependent, or what other arbitrary functions are being calculated as mandatory steps in run time. I was under the impression the vfp is containing the math/commands to define what's being drawn up for the reflection. Under that same assumption I was looking to create a stripped down vfp that skips certain aspects of the rendering. All I really need is the basic shapes of buildings and shore to complete the water line. It'll be blurred beneath other layers so it's not required to be %100 accurate with shadow casting. If it can reference texture data and ambient world lighting that's plenty helpful for it's purpose.

 

Of course this is assuming shadow rendering can just be skipped at this stage. Otherwise I'm kinda outta ideas for tonight. On a separate note is this fresnel.vfp, and that is the fact it cannot render the skybox (otherwise being a projection of a projection). Is there a way to just insert a black mask to substitute the space of, "nothingness" it's attempting to render? Then you'd have a mostly condensed image where a skybox cubemap can just be thrown on top of that to complete the sky reflection. It would be even cooler if the cubemap and mirrorRenderMap could be combined in the same MTR, but I get a, "too many texgens" error if they're based in the same material.

 

Long night here messing with this stuff, so I hope most of that made sense.

Modeler galore & co-authors literally everything

 

 

Posted

Well from what I'm gathering the dynamic reflection is re-rendering the scene.

Correct.

 

I guess what I'm unsure about is how much of this re-rendering is shader dependent, or what other arbitrary functions are being calculated as mandatory steps in run time. I was under the impression the vfp is containing the math/commands to define what's being drawn up for the reflection.

None of the rendering is shader-dependent. There are actually two separate things happening in this shader stage:

  • A mirrorRenderMap image map. This is not a shader, it is just an image map, like a diffuse or normal map, but this particular image happens to be the result of rendering a reflection from an appropriate camera position behind the surface. There is no way to control what this render contains; it is just a regular render as if you noclipped behind the plane and turned around to look back at your original position.
  • A fresnel.vfp custom shader. My understanding is that all this shader does is make the intensity of the stage dependent on the view angle, so you see more of the reflection at shallower angles and less reflection when looking straight ahead. You can most likely remove this shader entirely and you will still get the reflection, which demonstrates that the reflection has nothing to do with the shader.

It seems that what you really want is a way to control what is rendered by the mirrorRenderMap material stage, which is not possible without modifying the game code AFAIK.

  • Like 1
Posted

Didn't Arcturus come up with a fancy way of making realistic, animated water surface textures that could be adapted to have specular and bump and stuff?
Think there was some talk as Orbweaver confirmed in that it's killer render to do this, but the accurately moving water round a bend kinda trumped the need for it to reflect as a mirror, since the effect was awe-inspiring enough.

I can't find it now, but the water in the animated grass test maps from a while before still looks really nice:
http://forums.thedarkmod.com/topic/12985-animated-grass-test-map/

2nd & 3rd screenshots.

The water in this map has good reflections. The scenery is great. The light cast upon it works well, there is enough detail surrounding to not make it the main feature.

Increasing the detail of the objects that are being reflected - giving an impressionist feel to the reflections... it's really effective.
The pool has so much going on in it, it doesn't need to be an accurate mirror - it's a good example of good scene design that means no matter where your eye rests, the scene looks full.

Also, water doesn't reflect shadows... it reflects only reflects light.
This could easily be simulated by pointing spotlights onto the surfaces that the light from the water would reflect (eg, under a bridge over a canal, light is seen in the water from a streetlight, along with objects adjacent to the water body - the light from the source and the lighted objects is seen in the water reflection by default, but - the light bounces from the surface of the water, fake-reflected by use of a spotlight that has a watery light pointed up into the archway, casts shadows).

Don't see why that wouldn't work without having to mess with shaders or mirrors or grinding render to 0.1fps.

It's good, effective level design.
Fake it til you make it (or, more likely, someone else does and you steal it).

Sometimes mechanical illusion is as good coding magic, imo.

Posted

 

  • A mirrorRenderMap image map. This is not a shader, it is just an image map, like a diffuse or normal map, but this particular image happens to be the result of rendering a reflection from an appropriate camera position behind the surface. There is no way to control what this render contains; it is just a regular render as if you noclipped behind the plane and turned around to look back at your original position.
  • A fresnel.vfp custom shader. My understanding is that all this shader does is make the intensity of the stage dependent on the view angle, so you see more of the reflection at shallower angles and less reflection when looking straight ahead. You can most likely remove this shader entirely and you will still get the reflection, which demonstrates that the reflection has nothing to do with the shader

 

Interestingly if I remove the vfp line from the mtr the reflection will break. This is what spurred the idea on because I'd noted that the mirrorRenderMap has always done this same graphical glitch in the past (shown below) but was due to me not pairing a vfp in the material definition...

 

 

 

With fresnel.vfp

6lvSIDp.jpg

 

 

Without fresnel.vfp

 

d4sZqSg.jpg

 

 

 

That's when I started asking myself exactly how bound the mirrorRenderMap is to the vfp hooked into it? Thing is I don't know jack about ARB but these are just my ramblings from many frustrated hours of tinkering with it.

Modeler galore & co-authors literally everything

 

 

Posted

 

Interestingly if I remove the vfp line from the mtr the reflection will break. This is what spurred the idea on because I'd noted that the mirrorRenderMap has always done this same graphical glitch in the past (shown below) but was due to me not pairing a vfp in the material definition...

 

If the mirrorRenderMap is broken without the shader, it will be broken with the shader. All the shader can do in this case is hide the problem.

 

In the example you posted, I can't see any sign of reflection in the top image. Can you post a simpler or more brightly-lit example that makes the reflection more obvious?

 

Here is an example of a post by by nbohr that includes a mirrorRenderMap with no shader stage, although it includes some other texture parameters which may be necessary to get the correct result (I haven't tested it myself).

 

http://forums.thedarkmod.com/topic/14680-how-to-make-material-reflective/?do=findComment&comment=309753

  • Like 1
Posted

The example Arcturus supplied uses an almost identical mtr that Nbohr had listed minus the RGB line. My assumption is that mirrorRenderMap requires additional data by default because it'll fail to project correctly if the function is just used by itself. The only difference I'm seeing compared with the parameters others have used (without the vfp) is it will apply the fresnel like a mask to refine the areas it reflects.

 

Reflections in the prior image I posted are running but not at high intensity. This is the same material set with greater power...

 

MPY3J1Y.jpg

 

Note the surface is completely opaque as I haven't made any water depth adjustments. I'm going to have to substitute the texgen reflect (cubemap) of the water's surface to HeatHaze I recon, as I don't think cubemaps will accept scroll values for wave motion. One other drawback is that the cubemap's own generic reflection stage wont update with a moving _local map in my own tests. I know the cubemap itself is a static image but I was hoping I could scroll the local stage it refers to in order to get the motion needed. I really don't want to use specular maps as it's probably the worst generic map to use for water. However I may not have much of a choice there either.

 

For most reflections, this would be a piece of cake if we had access to parallax corrected cubemaps. :wacko:

 

Also something crazy to note, is that the mirror doesn't like props without a bottom. I've noted on the big footings I used in the shot (that don't have a bottom) get skewed reflections streaming out behind them. Relative to the player's view of course but it's a minor bug to note. I guess my decision now is to figure if it's really worth the performance deficit to use the mirrorRenderMap stage at all. It's for a very large and very open map that currently runs great but I can guarantee it'll bog lower end systems with this puppy doubling the render budget.

Modeler galore & co-authors literally everything

 

 

Posted
Also something crazy to note, is that the mirror doesn't like props without a bottom. I've noted on the big footings I used in the shot (that don't have a bottom) get skewed reflections streaming out behind them. Relative to the player's view of course but it's a minor bug to note.

 

That's exactly what I would expect. The mirror render takes place from a position below the water, looking upwards. The game does not render the backs of polygons correctly, so if the stones in the water don't have a bottom, they will at best be incomplete or missing, and at worst exhibit render artifacts like you describe.

 

I believe there is a twoSided material property you might be able to use to eliminate the problem, but adding a bottom to the objects would probably be better for performance, since you can minimise the number of polygons required to close the model whereas I think twoSided will just duplicate everything.

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

    • 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!
      · 3 replies
    • Goblin of Akenash

      My mapping discord if anyone is interested, its more of a general modding thing rather than just for TDM 
      https://discord.gg/T4Jt4DdmUb

       
      · 0 replies
×
×
  • Create New...