Force water plane rendering only inside map boundaries

Force water plane rendering only inside map boundaries

Discuss maps & map creation - from concept to execution to the ever elusive release.

Moderator: Moderators

Post Reply
User avatar
Beherith
Posts: 5145
Joined: 26 Oct 2007, 16:21

Force water plane rendering only inside map boundaries

Post by Beherith »

Recently many maps have only small bits of water on them, mostly for visual effect. I would like it if we had an SMD tag that culls all water planes beyond the map boundaries, so the whole map boundary isnt rendered with water. Currently only water 0 obeys map boundaries
Thanks
User avatar
jK
Spring Developer
Posts: 2299
Joined: 28 Jun 2007, 07:30

Re: Force water rendering only inside map boundaries

Post by jK »

Code: Select all

endlessOcean = (!!configHandler->Get("BumpWaterEndlessOcean", 1))
          && mapInfo->water.hasWaterPlane
          && ((readmap->minheight <= 0.0f) || (mapInfo->water.forceRendering));
User avatar
Argh
Posts: 10920
Joined: 21 Feb 2005, 03:38

Re: Force water rendering only inside map boundaries

Post by Argh »

Does that work on water 1 / 3, though?

<tests>

No. And it doesn't really cut off all rendering past the map border, either. There is a wavy reflection still.
User avatar
Beherith
Posts: 5145
Joined: 26 Oct 2007, 16:21

Re: Force water rendering only inside map boundaries

Post by Beherith »

Sorry, Im really thick; but i tried the smd tag:
BumpWaterEndlessOcean=0;
In the water section of smd, and it did nothing, could you please elaborate on the correct usage of this command?
User avatar
Otherside
Posts: 2296
Joined: 21 Feb 2006, 14:09

Re: Force water rendering only inside map boundaries

Post by Otherside »

afaik its a option on spring settings not on individual maps
User avatar
Beherith
Posts: 5145
Joined: 26 Oct 2007, 16:21

Re: Force water rendering only inside map boundaries

Post by Beherith »

Ah I see, could it be used on a per map basis?
User avatar
jK
Spring Developer
Posts: 2299
Joined: 28 Jun 2007, 07:30

Re: Force water rendering only inside map boundaries

Post by jK »

Beherith wrote:Ah I see, could it be used on a per map basis?
jK wrote:

Code: Select all

endlessOcean = (!!configHandler->Get("BumpWaterEndlessOcean", 1))
          && mapInfo->water.hasWaterPlane
          && ((readmap->minheight <= 0.0f) || (mapInfo->water.forceRendering));
Tobi
Spring Developer
Posts: 4598
Joined: 01 Jun 2005, 11:36

Re: Force water rendering only inside map boundaries

Post by Tobi »

What he means is, remove the 'planeColor' tag from the water subtable in the SMD, that has same effect as setting BumpWaterEndlessOcean to 0 in the user settings.

(Not everyone can read C++ and knows the spring source by heart...)
User avatar
Beherith
Posts: 5145
Joined: 26 Oct 2007, 16:21

Re: Force water rendering only inside map boundaries

Post by Beherith »

It works just as advertised:

Remove the
WaterPlaneColor=0.113 0.085 0.015;
tag from your SMD file, and the water will only render to the map boundaries

Thank you all for the help! Ill move this thread to mapping now as that seems its logical place.
User avatar
Forboding Angel
Evolution RTS Developer
Posts: 14673
Joined: 17 Nov 2005, 02:43

Re: Force water plane rendering only inside map boundaries

Post by Forboding Angel »

Well fuck me, nice find behe!
User avatar
lurker
Posts: 3842
Joined: 08 Jan 2007, 06:13

Re: Force water plane rendering only inside map boundaries

Post by lurker »

Nice find who?

And I don't see any need to be able to read code. It has the following English:

config something BumpWaterEndlessOcean
map info has water plane
map min height something
map info water force rendering


Basically, Beherith saw the first one and made a valid if mistaken effort at it. He should have then gone on to the other three. "has water plane" leads directly to trying to remove water plane from the smd.
User avatar
FLOZi
MC: Legacy & Spring 1944 Developer
Posts: 6242
Joined: 29 Apr 2005, 01:14

Re: Force water plane rendering only inside map boundaries

Post by FLOZi »

lurker wrote:Nice find who?

And I don't see any need to be able to read code. It has the following English:

config something BumpWaterEndlessOcean
map info has water plane
map min height something
map info water force rendering


Basically, Beherith saw the first one and made a valid if mistaken effort at it. He should have then gone on to the other three. "has water plane" leads directly to trying to remove water plane from the smd.
You don't see a need to read code because you can.
Tobi
Spring Developer
Posts: 4598
Joined: 01 Jun 2005, 11:36

Re: Force water plane rendering only inside map boundaries

Post by Tobi »

lurker wrote:Nice find who?

And I don't see any need to be able to read code. It has the following English:

config something BumpWaterEndlessOcean
map info has water plane
map min height something
map info water force rendering


Basically, Beherith saw the first one and made a valid if mistaken effort at it. He should have then gone on to the other three. "has water plane" leads directly to trying to remove water plane from the smd.
You have to know !! means not-not, which is just shorthand for conversion to boolean, you have to know && == and, you have to know || == or and you have to not be scared for formulas.

Besides that it isn't necessarily obvious that no water plane exists if a color has not been defined for it; many tags in Spring use a default value instead of using the existence of the tag as implicit configuration mechanism.

(For example, if you don't specify nano particle color in FBI a unit will still emit nano particles if it's a builder - it just uses the default color.)

Either way, I think it's obvious that quoting code is often not the best way to explain things.. (at best it gives a hint so someone who also happens to be able to make the same assumptions quickly can translate it into a better explanation.)
User avatar
lurker
Posts: 3842
Joined: 08 Jan 2007, 06:13

Re: Force water plane rendering only inside map boundaries

Post by lurker »

Tobi wrote:You have to know !! means not-not, which is just shorthand for conversion to boolean, you have to know && == and, you have to know || == or and you have to not be scared for formulas.
No you don't. I didn't even read the logic symbols when I looked at it. I looked at the words, the single = sign, and the <=, and the <= was gratuitous. I completely ignored the booleans, the parentheses, the !!, the quotation marks, the semicolon, that non-map-related word "Get", etc. In fact, I still haven't read the 'code' part of it as I make this post. Isn't everything I put in my first post just the words of the snippet plus a few 'something's?

And no, it's not immediately obvious what to do when you're trying to make it have no water plane, but you should see the 'water plane' tags and try something.
User avatar
FLOZi
MC: Legacy & Spring 1944 Developer
Posts: 6242
Joined: 29 Apr 2005, 01:14

Re: Force water plane rendering only inside map boundaries

Post by FLOZi »

lurker wrote:
Tobi wrote:You have to know !! means not-not, which is just shorthand for conversion to boolean, you have to know && == and, you have to know || == or and you have to not be scared for formulas.
No you don't. I didn't even read the logic symbols when I looked at it. I looked at the words, the single = sign, and the <=, and the <= was gratuitous. I completely ignored the booleans, the parentheses, the !!, the quotation marks, the semicolon, that non-map-related word "Get", etc. In fact, I still haven't read the 'code' part of it as I make this post. Isn't everything I put in my first post just the words of the snippet plus a few 'something's?

And no, it's not immediately obvious what to do when you're trying to make it have no water plane, but you should see the 'water plane' tags and try something.
Or, Jk could have just given a straightforward and clear answer in the first place, and we would have avoided this pointless discussion.
User avatar
lurker
Posts: 3842
Joined: 08 Jan 2007, 06:13

Re: Force water plane rendering only inside map boundaries

Post by lurker »

And probably with less effort then quoting the code.
User avatar
Beherith
Posts: 5145
Joined: 26 Oct 2007, 16:21

Re: Force water plane rendering only inside map boundaries

Post by Beherith »

Where I screwed up the interpretation is at the word waterplane. To me the word water plane means the very top of the water, not the ground beneath it. (even though i knew full well what waterplanecolor did in spring :? )

Also, im used to being given info in code, but i usually just keep asking till someone can tell me what it means :)

Anyhow thanks for the info guys, its a really good peice
User avatar
lurker
Posts: 3842
Joined: 08 Jan 2007, 06:13

Re: Force water plane rendering only inside map boundaries

Post by lurker »

But it does refer to the very top of the water in spring, what's the confusion?
User avatar
Beherith
Posts: 5145
Joined: 26 Oct 2007, 16:21

Re: Force water plane rendering only inside map boundaries

Post by Beherith »

lurker wrote:But it does refer to the very top of the water in spring, what's the confusion?
Gotcha :wink:
It doesnt. It refers to the extended ground plane rendered under the water.
Which is why I was confused.
User avatar
momfreeek
Posts: 625
Joined: 29 Apr 2008, 16:50

Re: Force water plane rendering only inside map boundaries

Post by momfreeek »

imo, sides should be rendered at the map edges (in some flat, boring color i guess) so you see the map as a solid chunk of ground rather than a paper-thin floating layer.
Post Reply

Return to “Map Creation”