Aller au contenu

Photo

Tileset Dynamic Grass Question


  • Veuillez vous connecter pour répondre
42 réponses à ce sujet

#1
Pstemarie

Pstemarie
  • Members
  • 2 745 messages
I was wondering if there was a way to get grass to render on more than one material. I'm working on a swamp tileset (using Mirkwood as a base) for my module and want grass growing in the bog terrain, not just on the default marsh terrain. Is this possible?

#2
Borden Haelven

Borden Haelven
  • Members
  • 403 messages
If you set the walkmesh to grass it is. Mind you that would remove the ripples and change the footsteps as well. You could reinstate the footsteps via a trigger & script. I don't know about the ripples.

Modifié par Borden Haelven, 18 août 2012 - 04:23 .


#3
henesua

henesua
  • Members
  • 3 872 messages
Pstemarie, check out Lord Rosenkrantz' immersive swamp. I believe he had grass in the water.

#4
Zwerkules

Zwerkules
  • Members
  • 1 322 messages
Maybe it is hardcoded that grass will be rendered on faces with the material id 3, but it is possible that it is rendered because the name is set to 'Grass' in the surfacemat.2da.
You could try to add a line 31:
31 Marsh 1 1 1 WT Grass 0 fx_step_splash
(and add your own effect instead of fx_step_splash if you like).
Then change the material id of some faces in a tiles walkmesh to 31 and see if it works.

#5
NWN_baba yaga

NWN_baba yaga
  • Members
  • 1 232 messages
that is a cool idea zwerkules, please tell us if that will work. Having a water effect with growing grass is awesome for marshlands...

#6
Pstemarie

Pstemarie
  • Members
  • 2 745 messages
Seems to be hard-coded. So now my next question to answer - is dynamic grass in water worth losing the ripple vfx?

#7
henesua

henesua
  • Members
  • 3 872 messages
If they are dense reeds, I say yes.

#8
Zwerkules

Zwerkules
  • Members
  • 1 322 messages
I tested it and it is possible to change the visual effects and footstep sounds, but the rendering of grass seems to be hardcoded. Not walkable grass would have been nice.

#9
Pstemarie

Pstemarie
  • Members
  • 2 745 messages
Yeah they are pretty dense - height setting of 1.5, density set to 4.0. Basically what I'm trying to achieve is the feeling of an overgrown swamp.

The location was once a tiny village on the coast that was protected from the ocean by a natural breakwater. However, when the breakwater gave way the village was flooded with water. Now all that remain are a few partially sunken buildings and a moldering chapel ruin.

#10
NWN_baba yaga

NWN_baba yaga
  • Members
  • 1 232 messages
then get rid of the ripple effect I might say. Having the grass swaying in the wind + a water texture is better as the other way around.

#11
Pstemarie

Pstemarie
  • Members
  • 2 745 messages
Ripples be gone :P I must say the overall effect is quite striking now that I've got the first semi-submerged building in place.  With the "natural" motion of the water you hardly notice the lack of the ripples - which imo were a tad overdone anyway (afterall you don't displace the water in circles unless you're dropping into it). 

Anyway, I'll post some screens once I get more features done....

Modifié par Pstemarie, 18 août 2012 - 07:59 .


#12
s e n

s e n
  • Members
  • 408 messages
you can animesh the water surface to get ripple like feature

#13
s e n

s e n
  • Members
  • 408 messages
should be doable even with applying flex on water surface, but never tried

#14
henesua

henesua
  • Members
  • 3 872 messages
excellent

#15
OldTimeRadio

OldTimeRadio
  • Members
  • 1 400 messages

Pstemarie wrote...
I was wondering if there was a way to get grass to render on more than one material. I'm working on a swamp tileset (using Mirkwood as a base) for my module and want grass growing in the bog terrain, not just on the default marsh terrain. Is this possible?


It appears to be. 

Two methods:
1. A placeable with WOK which is set static and placed using adjust location at the center of a tile in the toolset.
2. "Double WOKing" a tile by having two separate WOKmeshes on the same tile.
3. Doping the model with additional face data.  See here

In the video below, the first area I enter into has had grass applied using the placeable w/WOK and the second area uses "Double WOKing":
Image IPB

"Double WOKing" the tile so as to get grass and the water at the same time involves taking the normal WOK with modifier already applied, cloning it, deleting all faces which you don't want the grass on, then selecting the remaining faces and changing their Material ID to grass.  Finally, it may be necessary to unlink and relink the original WOK to the model base in order for both WOK meshes to be written to the same file.  I found my smaller WOK was not written out/written out correctly when it was below the full-size WOK in the hierarchy.

These are just the WOKs for TTR01_G02_01.mdl, with the grass WOK lifted up a bit to clarify what I'm talking about.  Normally, both the water portion of the main WOK and the grass WOK would occupy the same space.

Image IPB

Both techniques appear to work but there could always be quirks or problems which makes further testing necessary.

Modifié par OldTimeRadio, 19 août 2012 - 02:53 .


#16
s e n

s e n
  • Members
  • 408 messages
OTR: two separate wok meshes or a wok mesh that has double faces when required?

#17
OldTimeRadio

OldTimeRadio
  • Members
  • 1 400 messages

s e n wrote...
OTR: two separate wok meshes or a wok mesh that has double faces when required?

Two (normal) seperate WOK meshes in the same tile model, exported as one WOK file.  The WOK file will contain information about two separate aabb nodes, in this case with the grass mesh coming first.

Nothing fancy or odd about the meshes themselves.

Edit:  Sample file for download here, may not import properly into NWMax:

Replaces Rural tile TTR01_G02_01.  Should be pretty easy to get just placing the beginning of a stream someplace and tileset shows tile name at the bottom of the screen when mouse is hovering over tile.

Edit: Causes some kind of bizarre crashing problem with the toolset.  Removed link to file.

Modifié par OldTimeRadio, 19 août 2012 - 02:55 .


#18
Pstemarie

Pstemarie
  • Members
  • 2 745 messages
Cool concept OTR, but it crashes the toolset whenever I try to save. I would suspect its because on some of the tiles the geometry coverage with the second wok is 100%

#19
OldTimeRadio

OldTimeRadio
  • Members
  • 1 400 messages

Pstemarie wrote...
Cool concept OTR, but it crashes the toolset whenever I try to save. I would suspect its because on some of the tiles the geometry coverage with the second wok is 100%

You're right, I'm seeing that too.  I wasn't having the problem earlier so let me see if I can reconstruct where it's going wobbly.

#20
s e n

s e n
  • Members
  • 408 messages
can you try make a single mesh instead of two and see if that works too? maybe detach the grass wok faces and "hide" them under the water faces, just a 1 cm!

#21
OldTimeRadio

OldTimeRadio
  • Members
  • 1 400 messages
Stuff I tried(skippable and probably boring): Thank you for the ideas, SEN!  I tried the first one but not the second one and I also tried a bunch of other tests.  You guys could probably imagine all the ways to try to sneak that extra AABB in there.  None of them worked, though some of them caused more problems than others.  I have no idea what I was doing before or maybe if I was mistaken, but I ran through it a few times and just couldn't come up with something that didn't crash the toolset on exit.  Not the first time I've seen this particular problem with the toolset.  Game launches OK, module saves OK, but crash on exit.  I hit the Omnibus and looks like Lucifer Church ran into this problem along with Danmar and probably a couple of others, accidentally.  And from their comments it all seemed to point back to the AABB.  After quite a bit of trying to get that square peg into the round hole, I switched tacks and turned to the model itself.  The grass isn't a function of the AABB, it's a function of the material on each face.  Tried a bunch of cutting up my AABB node to get that to work and still nothing that seemed to work that didn't cause  a problem somewhere along the line.

However, I do think I might have nailed it: I hope, anyway.  Again, since it's "all about the faces", I went into the ASCII model, into the aabb node and found the water faces (which end in 6), copied them, pasted them at the end of the list of faces, changed the 6 at the end to 3 and then counted how many new lines I'd added.  Then I went back up to the "faces" count and incremented it by that many.  In this case, I added 14 new lines (these are copies of the water faces), and so my "faces 90" became "faces 104".  No AABB weirdness involved.  No duplicating AABB with this method.  This only affects the faces, which is the cue NWN is using to determine what needs to be drawn.  If anything, this is just doping the model with extra face data.  I tried compiling it externally and the external compiler doesn't seem to have a problem with it.

Download it here and give it a spin.

Modifié par OldTimeRadio, 19 août 2012 - 02:54 .


#22
s e n

s e n
  • Members
  • 408 messages
Otr: I know for sure that woks dont like verts that share XY position. To create those camera blocking tiles, just like Baba's Spidercaves to give you example, basically you use reversed obscuring faces, but you need to be sure that no vert of the obscuring roof shares XY value with the verts of the floor wok. but, the wok is always one! so maybe try that, just slightly offset XY values with the cloned and detached and reattached faces of the grass wok

#23
s e n

s e n
  • Members
  • 408 messages
img43.imageshack.us/img43/2236/swamp1.jpg

I got it: it is easy enough: you clone the faces you want with both grass and water, you slightly offset ( I say 5 cm) the shared XY verts of the cloned faces,  you flip the grass faces, and then you add the wok modifier and apply water where needed, and grass to the flipped ones. this way you get the grass to render (even with flipped faces, that doesnt interfere with the movement so you dont get movement weirdness, the grass will always render in vertical position with growing bottom->top) and you get splotches and water sound as you move. :wizard:

#24
NWN_baba yaga

NWN_baba yaga
  • Members
  • 1 232 messages
Very cool stuff guys:) I´ll add this way for grass at the river edges for any tileset in the future.

#25
OldTimeRadio

OldTimeRadio
  • Members
  • 1 400 messages
Hey, man- NICE!  And thanks for the information about the blocking tiles in Baba's spider caves, too.

How does that look when you have renderaabb on?  Will it compile with an external compiler?

Unless someone comes up with a problem with the method, I'm still sweet on just changing the faces.

Here's why:
-Modeling the grass through walkmesh affects the verts, faces, tverts and aabb.
-Simply adding extra faces to the face list only affects the faces and nothing more, but achieves the same effect.  Seems pretty benign in comparison.

Still, it's cool to see how many different ways we can approach the same problem!

Now, it doesn't look like anyone's downloaded the sample file I posted in the previous message so I'm not sure how much interest there is in a solution to this particular problem anyway.  But I think beyond attempting to address Pstemarie's question, these approaches also probably have applications outside of that narrow spectrum- and it'll be interesting to see what those wind up being.

Modifié par OldTimeRadio, 19 août 2012 - 03:34 .