Template Water Shader Problem

Posted By: SirSven

Template Water Shader Problem - 08/16/07 20:51

Hi,

I'm just got my new A7 comm and startet trying around a bit.
I tried the shader from the mtlFX.wdl and it works nice but I have a small problem.
Everything is rendered the wrong way around, means areas that are far away are rendered first.



As you can see the flames (it's not only happening with particles but with every object) are rendered infront of the spheres, but actually they are behind them.
What I don't understand is that when I have a look at the view used to render the mirror then I can't see the flames in it. What's wrong. Why is the stuff seen in the view different from the stuff the view renders to the image?

Thanks
Posted By: Schmerzmittel

Re: Template Water Shader Problem - 08/16/07 21:01

Did you use the fx_water_mirror? If yes, this shader only works with the Pro versoin of GS.
Posted By: SirSven

Re: Template Water Shader Problem - 08/16/07 21:23

Yes I used the fx_water_mirror but I have A7 comm and this supports render to textur. So imho it kind of works already but the result has some little error.
Maybe it's not totally clear what you see on this picture so what you see are two spheres, behind each sphere is a flame and the sphere are penetrated by the water plane in their middles (it also happens if there is no intersection between water and objects). The flames are behind the spheres and thats correct in the view but in the effect on the water it's then wrong. Is that normal?
Posted By: S3an

Re: Template Water Shader Problem - 08/17/07 03:31

i can confirm that fx_water_mirror will work fine with A7 comm. a couple of things to double check maybe..

  • Use a flat terrain .hmp file with at least 32 verticies in x and y directions
  • Assign a bump map texture to skin 1 of the terrain. There is a good bump located in your 3dgs install at "template_6\images\waves.dds"

That should be all you need to get things going. I always add a skybox in the level just to give me some bearings to the world, plus it keeps the background from smearing when moving making it harder to tell what is really going on. hope that helps!



Posted By: SirSven

Re: Template Water Shader Problem - 08/17/07 04:52

I think the shader itself is working but I have these sorting errors...

Here everything is correct:


But when the reflections intersect I get the error:


PS: I'm sorry for the big images but on the pc I'm working on at the moment only A7 and Firefox works, every other programm is crashing it (even mspaint)
To much viruses... Luckily it's not my pc
Posted By: S3an

Re: Template Water Shader Problem - 08/17/07 08:32

Oh, now i understand. i never noticed that issue before. is that the same terrain, the island and the shore? If i can duplicate it i can try my hand at fixing it. Probably needs a different reflection view to make it work right.
Posted By: SirSven

Re: Template Water Shader Problem - 08/17/07 08:40

It happens with the same terrain, but also with different objects. All visible triangles in the view are rendered from the back to the front.
Posted By: Slin

Re: Template Water Shader Problem - 08/17/07 10:26

I´m not sure but it is possible that the view used for the reflections is placed under the terrain. Try to make the water deeper.
Posted By: SirSven

Re: Template Water Shader Problem - 08/17/07 15:13

Ok, I tried around a bit and I found out that it's only happening when the camera.pan is more then 180. But it doesn't matter wheather the objects are under the water plane or not it happens in every case. But as mentioned before everything is correct when you have a look at the view directly...

pan < 180 = correct

pan > 180 = error

Posted By: Schmerzmittel

Re: Template Water Shader Problem - 08/17/07 18:56

Ich finde es ja schön, dass bei euch der Shader geht

Aber bei mir geht gar nichts....ich habe die Mtlfx.c included, aber, wie in einem anderem Post (wie ich schon geschrieben hab), funktioniert bei mir gar nichts.

Wie habt ihr das eingebunden, bzw. zum laufen gebracht?

Bei mir kommt immer dieser Fehler

Malfunction W1550
-----------------
Error in effect:
(23): error X3003: redifinition of 'matWorldView'

>float 4x4 matWorldView;<

Ich habe, wie in diesem Post http://www.coniserver.net/ubbthreads/showflat.php/Cat/0/Number/775919/an//page/0/vc/1
die Zeilen schon abgeändert, aber es geht nicht.

Könnte mir, falls es möglich ist, die mtlfx.c und die default.fx vielleicht schicken? Wäre super. Ich will auch das Wasser, in Verbindung mit dem Terrainshader.

Um jede Hilfe wär ich mehr als dankbar.

Grüße
Schmerzmittel
Posted By: Uhrwerk

Re: Template Water Shader Problem - 08/17/07 21:31

Das hier ist der entscheidende Post von JCL, das muss abgeändert werden:
Quote:

Yes, this is a bug in default.fx. It happens when you use <fog> and <view> at the same time in a shader.

Solution: Edit default.fx and replace

float4x4 matWorldView;

by:

#ifndef MATWORLDVIEW
float4x4 matWorldView;
#define MATWORLDVIEW
#endif

This ensures that matWorldView is only defined once.



Posted By: Schmerzmittel

Re: Template Water Shader Problem - 08/17/07 21:41

Hab ich ja gemacht, aber es kommt trotzdem noch der Fehler, dass matWorldView doppelt definiert wurde. Das ist es ja grade, was ich nicht verstehe.
Posted By: vlau

Re: Template Water Shader Problem - 08/19/07 08:44

I have followed the steps from above posts and still
don't get the shader work. I've try the following
shaders from the mtlFX.c (version A7.05)

fx_water_mirror : The water.hmp shows black and semi-transparent
fx_water_env : The water.hmp is invisible

Any ideas?
Posted By: Joey

Re: Template Water Shader Problem - 08/19/07 13:13

don't you need that cull counter clockwise flag for mirror views? cull_cw or something the like.
Posted By: vlau

Re: Template Water Shader Problem - 08/19/07 13:56



I've attached fx_water_mirror action to the water.hmp but no effect.
I suppose those shaders from mtlFX.c are easy and ready to use but
it didn't.
Posted By: Schmerzmittel

Re: Template Water Shader Problem - 08/19/07 15:13

I have the same problem as Vlau...

Now, with the new Beta, no Error. But the Mirror_water shows a black surface and its transparent.

The water_env works good.

If i use the water_mirror it works with c_script. But i want use Lite_c.
Posted By: Schmerzmittel

Re: Template Water Shader Problem - 08/19/07 18:10

Ich habe rausgefunden, warum das Wasser unter LiteC nichts spiegelt und nur Schwarz ist.

Sucht einfach nach der Zeile mtlfx_mirrorvisible = 0; und setzt sie auf 1.
Dann wird auch was reflektiert. Aber mich wundert nur, warum das von Haus aus auf 0 gesetzt wurde?

Jetzt läuft das Wasser.
Posted By: Schmerzmittel

Re: Template Water Shader Problem - 08/19/07 18:26

Nun arbeitet das Wasser. Aber der nächste Fehler ist schon da...
Anscheinend ist die View von der Camera etwas zu groß.

Hat da jemand Rat?




Wenn jemand da ne Lösung weis, wär ich sehr froh.

Gruß
Schmerzmittel
Posted By: ulf

Re: Template Water Shader Problem - 01/14/08 20:27

can anyone provide a simple working demo.wmp with a water.hmp (bumpmap in skin1), with the latest water template shader(fx_water_env) action attached + a skycube?

i seem to get some strange results using this (template) shader and want to verify its not my fault... ): thanks!
Posted By: Slin

Re: Template Water Shader Problem - 01/15/08 14:05

Do you use a shader on the terrain? If you use a not ffp-effect on it the clipping will be wrong. That causes errors as on the screenshots above.
Posted By: Schmerzmittel

Re: Template Water Shader Problem - 01/16/08 16:21

Jep.

Auf dem Terrain sind Shader drauf. Im handbuch steht auch, das die Funktion über Clipping läuft und daher keine Shader gespiegelt werden.

Aber wie ist das bei sagen wir mal Far Cry u.ä.? Da wird ja auch alles gespiegelt.
Posted By: Slin

Re: Template Water Shader Problem - 01/16/08 16:36

Klar, das funktioniert auch, aber dann muss das Clipping in den Terrainshader. Oder du renderst das Terrain für die Reflektion ohne Shader. Es geht bestimmt auch noch anders, aber dies wäre die simpelste Möglichkeit.
Posted By: ulf

Re: Template Water Shader Problem - 01/18/08 22:16

is this:

really what should come out of the template water shader fx_water_env ? i only get this result out of it...

Posted By: Schmerzmittel

Re: Template Water Shader Problem - 01/21/08 22:16

Slin, du bist ja hier der Shaderguru ;o).

Ne im Ernst. Ich habe leider (noch) keine Ahnung von Shadern usw. Ich boxe mich halt so durch, um den Spaß willen.

Ich werde mich mal, wenn ich Zeit dazu finde, dahinter klemmen. Aber für jeder brauchbare Lösung wäre ich mehr als dankbar. Oder zumindest vlt. ein Codeschnipsel^^.

Trotzdem noch gutes Gelingen.
Posted By: Slin

Re: Template Water Shader Problem - 01/21/08 22:22

Versuch ersteinmal das normale 3DGS Clipping abzuschalten. Das reicht für einfache Situationen schon aus.
Posted By: Schmerzmittel

Re: Template Water Shader Problem - 01/25/08 15:47

Danke werde ich mal probieren
© 2024 lite-C Forums