Kart Racing Pro Official Forum

Mods => Track Editing => Topic started by: rainey06au on July 31, 2020, 12:28:08 PM

Title: Is it possible to do 3D grass and wet reflections from 3DS Max 2013 x64?
Post by: rainey06au on July 31, 2020, 12:28:08 PM
For the past week I've been struggling with the process to render 3D grass blades (.grs file) and wet track reflections (alpha map on second UVW Map channel).  My workflow is to have built my mesh and assigned standard materials in 3DS Max 2013, exported to FBX and then using the 'fbxtoedf' tool I convert my 3D objects (track mesh, terrain, and buildings), and the compile using Terrained etc.  I am now wondering if these two particular issues are even possible to support without having a 3DS Max 2013 x64 compatible plugin for exporting?  Ingame I don't have any 3D grass, and my track surface just gets darker with the wetness slider but I don't see my puddles. Can someone please tell me if I'm doing something wrong of if I'm wasting my time without a 2013 plugin.
Title: Re: Is it possible to do 3D grass and wet reflections from 3DS Max 2013 x64?
Post by: LXS77 on August 03, 2020, 12:05:18 AM
Hi, not sure about puddles, but for a 3D grass a 2013 plugin is definitely not needed. The FBX2EDF tool will do it for you. The trick is that the .GRS should have exactly the same name as your main grass texture file. For example, if your 2D grass texture is named grass_main.dds, the .GRS to generate 3D blades on this surface should be called grass_main.grs. Then a very good start for a 3D grass blade texture would be PiBoSo's original grassfx.tga from his example track files (you can find the link on this page - http://docs.piboso.com/wiki/index.php?title=MXB_Track_Creation_Guide). Once your .FBX is ready, simply put a .GRS file and grassfx.tga into the same directory where all your track's textures are and run FBX2EDF to create a .MAP file. If all goes well, you should be able to see 3D grass when viewing the track in MapView.
Title: Re: Is it possible to do 3D grass and wet reflections from 3DS Max 2013 x64?
Post by: rainey06au on August 03, 2020, 03:41:48 PM
I just can't get it to work. As far as I can tell I have everything required in place.  In the attached screenshot you can see I don't have a line in the .grs file to call for the mask map (just trying to get the compiler to draw the 3d blades in ANY form to begin with!) but it should be drawing the grass blades across the entire texture and DOESN'T! Cannot figure this one out!
Title: Re: Is it possible to do 3D grass and wet reflections from 3DS Max 2013 x64?
Post by: rainey06au on August 03, 2020, 04:09:18 PM
Pretty keen to finish off the look of my environment and it's driving me bonkers. You can see I've got working bump, and specular maps etc. With the wet surface I've tried a variety of dropping the RGB to white and just having an alpha etc.

(https://i.imgur.com/LY98skQ.jpg)

(https://i.imgur.com/cVFlbOE.jpg)

(https://i.imgur.com/ecaGDhU.jpg)

(https://i.imgur.com/MgIt7OC.jpg)

(https://i.imgur.com/X2E1p1W.jpg)
Title: Re: Is it possible to do 3D grass and wet reflections from 3DS Max 2013 x64?
Post by: LXS77 on August 03, 2020, 04:45:06 PM
Hi, the track looks great indeed! Well done!

I'm just looking at the file size of grassfx.tga. On your screenshot it's only 240KB. The PiBoSo's file weighs 1MB (1024x256px). Try to use his file without any amendments to it. And what's the resolution of your GND_grass006e6 texture?
Title: Re: Is it possible to do 3D grass and wet reflections from 3DS Max 2013 x64?
Post by: rainey06au on August 03, 2020, 04:50:59 PM
Hmm good observation!  I had used the original grassfx.tga but made some colour adjustments. I think maybe I've lost something when I did that. I have just put the original grassfx.tga from the example map back instead. Currently compiling so I'll let you know how it goes in 10 mins!  The resolution of my grass006e6 is 2048x2048 and same with the mask '_g' version.
Title: Re: Is it possible to do 3D grass and wet reflections from 3DS Max 2013 x64?
Post by: rainey06au on August 03, 2020, 05:12:55 PM
Still no 3D grass. There's nothing special about the infield meshes in 3DS Max or the texture map (pic attached)
Title: Re: Is it possible to do 3D grass and wet reflections from 3DS Max 2013 x64?
Post by: LXS77 on August 03, 2020, 06:59:48 PM
Yeah, it looks fine...

Well, that's how it works in my case (image attached). If you don't mind sharing the FBX file, just PM me, will try to see what goes wrong there...
Title: Re: Is it possible to do 3D grass and wet reflections from 3DS Max 2013 x64?
Post by: rainey06au on August 04, 2020, 02:46:47 AM
Hmmm yes your effect is really good. The track surface and the grass terrain are all combined into a single .EDF model in my track. Do you know if this could be a problem? Do all of the TRKGRAS_ surfaces need to exist exclusively in their own .EDF?
Title: Re: Is it possible to do 3D grass and wet reflections from 3DS Max 2013 x64?
Post by: LXS77 on August 04, 2020, 12:37:41 PM
Thanks! :)

But why would you use EDF for that? According to http://docs.piboso.com/wiki/index.php?title=FBX2EDF, Mesh (.edf) should be used for things like skydomes and helmets. For track geometry and track objects, there are MAP (.map) and Collision (.trp).
Title: Re: Is it possible to do 3D grass and wet reflections from 3DS Max 2013 x64?
Post by: rainey06au on August 04, 2020, 02:13:31 PM
Dude!!!  That's probably it!!  I didn't really know what the other options were and hadn't been reading the FBX2EDF guide! Funnily enough the track has been driving well on an EDF file..
Title: Re: Is it possible to do 3D grass and wet reflections from 3DS Max 2013 x64?
Post by: LXS77 on August 04, 2020, 03:09:20 PM
Yep, guides can sometimes be useful :) Just try to create a .MAP file and open it with MapView, let's see if this makes any difference.
Title: Re: Is it possible to do 3D grass and wet reflections from 3DS Max 2013 x64?
Post by: rainey06au on August 04, 2020, 03:21:03 PM
Thank you mate! You're a genius. That's exactly where I was going wrong.  3D grass will not draw from a standard .EDF model.  That's made my day! :)
Title: Re: Is it possible to do 3D grass and wet reflections from 3DS Max 2013 x64?
Post by: LXS77 on August 04, 2020, 03:38:29 PM
:D  You're most welcome! And don't forget about the collision file (.trp), you'll need it to finalise the track in TrackED (central line, dynamic surface, grid, pits, etc.)
Title: Re: Is it possible to do 3D grass and wet reflections from 3DS Max 2013 x64?
Post by: rainey06au on August 05, 2020, 06:54:36 AM
I exported the same FBX file as a .trp for the collision as well assuming that is the correct thing to do.  Now I'm stuck trying to figure out how my .hmf and .tht files should look for a mesh only track (because originally I was using a heightmap just below my .edf objects). But of course now I don't want to use my heightmap.raw or any of those parameters. I just want my SURFACE.map and COLLISION.trp files to be the main track base.

samples_x = 4097
samples_z = 4097

data = heightmap.raw

size_x = 700
size_z = 700
scale = 100

num_layers = 3
layer0
{
map = maps/mud_treads.tga
frame1
{
map = maps/mud_treads_wet.tga
}
repetitions = 50
}

layer1
{
map = maps/mud.tga
frame1
{
map = maps/mud_wet.tga
}
repetitions = 50
thickness = 0.1
}

layer2
{
map = maps/SAT_colornear001.tga
frame1
{
map = maps/SAT_colornear001.tga
}
repetitions = 1
mask = mask_color.tga
thickness = 0.4
}

scene0
{
name = OBJ_SURFACE.edf
pos
{
x = 0
y = 0
z = 0
}
rot
{
x = 0
y = 0
z = 0
}
}

scene1
{
name = OBJ_BUILDINGS.edf
pos
{
x = 0
y = 0
z = 0
}
rot
{
x = 0
y = 0
z = 0
}
}

scene2
{
name = OBJ_TYRESTACKS.edf
pos
{
x = 0
y = 0
z = 0
}
rot
{
x = 0
y = 0
z = 0
}
}

scene3
{
name = OBJ_2DTREES.edf
pos
{
x = 0
y = 0
z = 0
}
rot
{
x = 0
y = 0
z = 0
}
}

scene4
{
name = OBJ_3DTREES.edf
pos
{
x = 0
y = 0
z = 0
}
rot
{
x = 0
y = 0
z = 0
}
}

scene5
{
name = OBJ_MARKERS.edf
pos
{
x = 0
y = 0
z = 0
}
rot
{
x = 0
y = 0
z = 0
}
}

scene6
{
name = OBJ_BARRIERS.edf
pos
{
x = 0
y = 0
z = 0
}
rot
{
x = 0
y = 0
z = 0
}
}

EDIT: Actually I have managed to compile my map without running TERRAINED at all.  I just used TrackED to take the collision file and merge with my centerline, deleted my .TRH in my output and replaced with my new .TRP. Dropped in my .MAP file of my surfaces and ran the track. But now I have a new problem...  The grass is on every surface named TRKGRAS_ and doesn't seem to obey the .GRS files, nor the DENSITY maps. In fact even when I remove the Grassfx.tga file I still have grass on my surfaces! Eeek. I'm a bit confused.
Title: Re: Is it possible to do 3D grass and wet reflections from 3DS Max 2013 x64?
Post by: rainey06au on August 05, 2020, 10:14:45 AM
Okay I'm getting closer through a lot of trial and error!  Obviously the density is too high but I needed to see proof that my densitymap was actually working.

I still don't know how to combine my .EDF objects into the .MAP file though. :(
Title: Re: Is it possible to do 3D grass and wet reflections from 3DS Max 2013 x64?
Post by: LXS77 on August 05, 2020, 11:36:41 AM
Right, OK, looks like you're following a procedure of creating a track for MX Bikes (another project by PiBoSo). Kart Racing Pro, however, uses a different approach, which is (in my opinion) way simpler .

I highly recommend going through these articles:
1. http://docs.piboso.com/wiki/index.php?title=Track_Creation_Guide
2. http://docs.piboso.com/wiki/index.php?title=TrackEd
3. http://docs.piboso.com/wiki/index.php?title=MapView

All your objects should stay in 3DS Max as a part of your track. No need to export them separately into different formats. They only thing you need to do before exporting into .FBX - name surfaces and collidable objects as described in the Track Creation Guide.

P.S. And one more thing - .map, .trp and the sub-directory where these files are located should have the same name (e.g. sampletrack.map and sampletrack.trp sitting in sampletrack sub-dir). Another example is the filelist of the Lydd track (image attached).
Title: Re: Is it possible to do 3D grass and wet reflections from 3DS Max 2013 x64?
Post by: rainey06au on August 05, 2020, 11:48:49 AM
Quote from: LXS77 on August 05, 2020, 11:36:41 AMAll your objects should stay in 3DS Max as a part of your track. No need to export them separately into different formats. They only thing you need to do before exporting into .FBX - name surfaces and collidable objects as described in the Track Creation Guide.

You're right, I did start with MX Bikes, but I've been referencing those resources in my efforts to make this KRP track.  All my objects are correctly named, so it sounds like I just need to select them all in one go from 3DS Max and export them to one single .FBX file. Then disregard all the other parts of the MX Bikes compile process.
Title: Re: Is it possible to do 3D grass and wet reflections from 3DS Max 2013 x64?
Post by: LXS77 on August 05, 2020, 12:08:36 PM
Exactly :)
Title: Re: Is it possible to do 3D grass and wet reflections from 3DS Max 2013 x64?
Post by: rainey06au on August 05, 2020, 12:32:37 PM
I've discovered another little setback.  Looks like you can't use more than 1 different densitymap in a project. I had different masks made for my different grass textures but when I leave them in the .GRS file it does some sort of funky blend of them in the distribution of 3d grass... sadly.
Title: Re: Is it possible to do 3D grass and wet reflections from 3DS Max 2013 x64?
Post by: rainey06au on August 05, 2020, 01:15:01 PM
So I'm pretty happy with how it looks with some grass. I wanted to have the bare patches of dirt stay bare so I made the density mask. It's got some side effects across some of my terrain grass textures but you don't notice for the most part.  My rain puddles are not working still but I'm much happier with this workflow now thanks to you LXS77. :)

(https://i.imgur.com/E9tFBiv.jpg)

(https://i.imgur.com/Uu0fFf8.jpg)

(https://i.imgur.com/QgBMy0w.jpg)
Title: Re: Is it possible to do 3D grass and wet reflections from 3DS Max 2013 x64?
Post by: LXS77 on August 05, 2020, 02:29:20 PM
Quote from: rainey06au on August 05, 2020, 12:32:37 PMI've discovered another little setback.  Looks like you can't use more than 1 different densitymap in a project. I had different masks made for my different grass textures but when I leave them in the .GRS file it does some sort of funky blend of them in the distribution of 3d grass... sadly.

It's one density map per texture. You can create individual .grs files for each grass texture, FBX2EDF will process them. Just keep the density map in the TGA's Alpha channel.
Title: Re: Is it possible to do 3D grass and wet reflections from 3DS Max 2013 x64?
Post by: LXS77 on August 05, 2020, 02:33:35 PM
Quote from: rainey06au on August 05, 2020, 01:15:01 PMSo I'm pretty happy with how it looks with some grass. I wanted to have the bare patches of dirt stay bare so I made the density mask. It's got some side effects across some of my terrain grass textures but you don't notice for the most part.  My rain puddles are not working still but I'm much happier with this workflow now thanks to you LXS77. :)


Glad I could help! :)

The track looks great! Are you going to publish it when it's ready or is it just for personal use?
Title: Re: Is it possible to do 3D grass and wet reflections from 3DS Max 2013 x64?
Post by: rainey06au on August 05, 2020, 02:41:59 PM
Quote from: LXS77 on August 05, 2020, 02:29:20 PMIt's one density map per texture. You can create individual .grs files for each grass texture, FBX2EDF will process them. Just keep the density map in the TGA's Alpha channel.
Isn't working for me, I create .GRS files for each texture with the correct values inside the code, including referencing the different density .TGA of each texture (all suffixed with '_g'). RGB channel is 255 white, alpha channel is my density. FBX2EDF starts to mix them together with some very bizarre behavior. I decided to just use my edge density map across all textures in the end because I really didn't want grass being drawn right up to the track edge (through the dirt).

I am developing the track as a training tool for my 10yo daughter and to improve my modelling abilities (hence the attention to detail). No plans to release publicly but I might one day!

I just cut some test laps (in 10% wet lol) running the track counter clockwise for fun (it's currently running clockwise in reality, you can see some onboards from my daughter if you browse my YT channel).
Title: Re: Is it possible to do 3D grass and wet reflections from 3DS Max 2013 x64?
Post by: LXS77 on August 05, 2020, 08:22:34 PM
Quote from: rainey06au on August 05, 2020, 02:41:59 PMIsn't working for me, I create .GRS files for each texture with the correct values inside the code, including referencing the different density .TGA of each texture (all suffixed with '_g'). RGB channel is 255 white, alpha channel is my density. FBX2EDF starts to mix them together with some very bizarre behavior. I decided to just use my edge density map across all textures in the end because I really didn't want grass being drawn right up to the track edge (through the dirt).

I've run some tests with multiple grass textures and separate .GRS files. Well, yeah, this densitymap thing is weird. Perhaps, there's something wrong with the function (if I'm not mistaken, in the MXB process there was a single grass density mask for the entire track) or we're just using it incorrectly (which is more likely) ;D

Anyway, it's an optional feature and you can still play with the max_density value for each grass texture (gives pretty good results BTW).

Quote from: rainey06au on August 05, 2020, 02:41:59 PMI am developing the track as a training tool for my 10yo daughter and to improve my modelling abilities (hence the attention to detail). No plans to release publicly but I might one day!

Ah, I see. Well, for training purposes the track's perfect! All the best to your future Jamie Chadwick! :)
Title: Re: Is it possible to do 3D grass and wet reflections from 3DS Max 2013 x64?
Post by: rainey06au on August 10, 2020, 03:12:57 PM
Thanks mate! I'm pretty happy with the track so far.  I managed to get the wet track puddles working by using Channel 2 in the Specular map rather than the Glossiness map of the material. Still doesn't seem right though, near reflections don't appear to reflect the skydome, but 100m in the distance the track does appear to reflect the skydome.  Not sure if I should be specifying reflections in the .shd or not (I'm assuming the reflection factormin etc. is only for a permanently reflective surface like glass or water).
Title: Re: Is it possible to do 3D grass and wet reflections from 3DS Max 2013 x64?
Post by: LXS77 on August 11, 2020, 10:37:02 PM
I'm glad you're enjoying the results! Sadly, can't help you with puddles (just never done them for my tracks). Have you studied the Track Creation Guide?  ;) Though it doesn't really provide detailed instructions on this matter, it definitely mentions rain puddles as a texture in the Specular channel :)
Title: Re: Is it possible to do 3D grass and wet reflections from 3DS Max 2013 x64?
Post by: rainey06au on August 14, 2020, 03:39:50 AM
Dude I have the Piboso Track Creation Guide open whenever I'm working on my track but there are so many things that it doesn't cover in detail, so I research on these forums and only find small pieces of information from other members, usually with expired images etc. so it's really hard to learn how things work with so much old information floating around. I know rain puddles can be in the specular but I saw other members confirming that it works in the glossiness as well, which in my attempts does not work.
Title: Re: Is it possible to do 3D grass and wet reflections from 3DS Max 2013 x64?
Post by: rainey06au on August 15, 2020, 07:39:03 PM
Just so people can see what I mean. Rain at overcast looks correct, but rain during clear day does not reflect the sky.

(https://i.imgur.com/mJdbmZX.jpg)

(https://i.imgur.com/zXQGznN.jpg)

(https://i.imgur.com/tF89CZp.jpg)

(https://i.imgur.com/3z3TolZ.jpg)
Title: Re: Is it possible to do 3D grass and wet reflections from 3DS Max 2013 x64?
Post by: PiBoSo on August 16, 2020, 12:22:22 PM
Quote from: rainey06au on August 15, 2020, 07:39:03 PMJust so people can see what I mean. Rain at overcast looks correct, but rain during clear day does not reflect the sky.

Please note that the sky is not reflected in puddles.
A constant color is used instead, that is set with "sky_color", for each weather condition, in the track AMB file.
Title: Re: Is it possible to do 3D grass and wet reflections from 3DS Max 2013 x64?
Post by: rainey06au on August 16, 2020, 01:15:24 PM
Quote from: PiBoSo on August 16, 2020, 12:22:22 PMPlease note that the sky is not reflected in puddles.
A constant color is used instead, that is set with "sky_color", for each weather condition, in the track AMB file.

Thanks Pib! That's a simple answer, I'll play around with my values in my AMB file.  8)
Title: Re: Is it possible to do 3D grass and wet reflections from 3DS Max 2013 x64?
Post by: rainey06au on August 16, 2020, 06:10:51 PM
Thank you sir. That has worked a treat. Got my head around most of it now!  I didn't have any color values in for Clear sky, so I added R=0.8, G=0.9, B=1.0, and it's given me a nice slightly blue tint to the reflections.

(https://i.imgur.com/WDjoGdk.jpg)

(https://i.imgur.com/BqDNf3Q.jpg)

(https://i.imgur.com/ke38yDz.jpg)