Talk:Func water analog

From Valve Developer Community
Jump to: navigation, search

I'm curious - why exactly does it have to be used with the nature/water_movingplane material? I know Valve used it that way, and I certainly use it that way, but not the rationale for it. Performance reasons? Does it simply look better? Would it crash the game, otherwise? --Campaignjunkie (talk) 15:57, 16 Oct 2005 (PDT)

I just checked the source files for seems there is no real reason under it—ts2do (talk) 16:40, 16 Oct 2005 (PDT)
That comes from here. I assumed that wisemx knew what he was talking about. I'll ask whether he knows what it's about. —Maven (talk) 18:30, 16 Oct 2005 (PDT)
Pertinent forum thread: [1]Maven (talk) 18:45, 16 Oct 2005 (PDT)

Still don't see is a normal water material—ts2do (talk) 18:52, 16 Oct 2005 (PDT)

You're very probably right. (That forum link was only pointing out the original source, by the way.) In the future I'll try to be more careful about this sort of thing. —Maven (talk) 19:01, 16 Oct 2005 (PDT)
Lol you make it sound like you raided a diamond shop—ts2do (talk) 06:00, 17 Oct 2005 (PDT)

Update, there are two materials that can be used with func_water_analog.
nature/water_movingplane and nature/water_dx70 will both function properly.
Here's a sample project I created with moving waters and 17 SDK materials [2]
These are the only two materials that will allow the Player to look back out of the water, and they are the only two that will work for dx7 systems.
The sample file contains the vmf and bsp. --wisemx 07:35, 17 Oct 2005 (PDT)

So the next question is: what makes those two materials special? —Maven (talk) 17:56, 17 Oct 2005 (PDT)

This next part gets rather technical.
If you examine func_movelinear.cpp you'll find:
LINK_ENTITY_TO_CLASS( func_water_analog, CFuncMoveLinear );
Indicating func_water_analog is func_movelinear with a few twists.

bool CFuncMoveLinear::ShouldSavePhysics( void )
        // don't save physics for func_water_analog, regen
        return !FClassnameIs( this, "func_water_analog" );


bool CFuncMoveLinear::CreateVPhysics( void )
        if ( !FClassnameIs( this, "func_water_analog" ) )
                //normal door
                if ( !IsSolidFlagSet( FSOLID_NOT_SOLID ) )
                        VPhysicsInitShadow( false, false );

We don't have physics mass, we aren't solid and we don't cast a physical shadow.
Take a look at the materials used for NATURE/WATER_MOVINGPLANE:
water_movingplane.vmt -> nature/water_movingplane_dx70 -> nature/water_movingplane_beneath.
Which is why the two I listed allow the Player to see back out from inside the water. --wisemx 18:12, 17 Oct 2005 (PDT)

Yes it's dx7...and yes it has a beneath material...what's that mean for seeing thru it?—ts2do (talk) 18:37, 17 Oct 2005 (PDT)
If you run my sample above, with 17 water materials on func_water_analog, and get in the water crouched down looking up you will only be able to see out of the water on the two mentioned here, for all the others you will only see a black barrier. I don't have a dx7 system to test with but mappers who do have told me dx7 can't see anything at all with the other water materials applied to func_water_analog, above or below. --wisemx 04:09, 18 Oct 2005 (PDT)

I hope that'll do. I'm making an educated guess based off my experience with water in Source. ;) --Spektre1 15:41, 18 Oct 2005 (PDT)

Thanks for putting this one to bed. :-) --wisemx 16:42, 18 Oct 2005 (PDT)

Well, It seemed fairly obvious to me, hehe. Just trying to do my part. --Spektre1 08:08, 19 Oct 2005 (PDT)

Func_water_analog and _rt_WaterReflection and _rt_WaterRefraction

The reason nature/water_movingplane and nature/water_dx70 work as expected with func_water_analog is because they and their beneath materials do not rely on _rt_WaterReflection and _rt_WaterRefraction. These render textures are not properly updated by a func_water_analog, if at all. Incidentally, DX70 fallback materials also work properly, as they do not rely on any render textures.

Materials created for use with func_water_analog should thus avoid the use of these render textures, until sufficient changes are made to update these textures properly.

Demented 20:17, 13 March 2010 (UTC)

Thinking about it... If you need your moving water to refract and reflect, you can parent a func_reflective_glass to it(or a func_movelinear). With a custom texture of course(use glass/reflectiveglass001 as reference). Gary 03:41, 9 June 2012 (PDT)