Hello and welcome to the MystyMoods!
The MystyMood Template is an outdoor environment template that can be included in any 3D GameStudio project (from version 6.4 up to A7...as long as it still supports c-script syntax).
This package is suited for both, beginners and more advanced 3dgs users. Beginners can learn something about setting up game outdoor environments and may have some fun tweaking the values. More advanced users can speed up their game production not having to care too much about environment stuff but still being able to easily finetune all relevant values...and they can laugh about my sensless sripting ;-)
This template works best using pixel-shader v. 2.0 and vertex-shader v. 1.3. but it will also run on non-shader hardware (using the fixed function pipeline).
MystyMood comes with fully accesible sources and can be extended and changed to your own needs (requires knowledge of c-script!).
If you want to create an ingame skycube-map (wich is needed for the shader-water-reflection), you also need to include the cubemap generation wdl somewehre at the begining of the mystymood.wdl (commented by default): include <cubemap_gen.wdl>;
Note: When generating an ingame cubemap, clouds movement speed should be set to "0" .Dynamic sun and lensflare must also be switched off (can be done at the begining of the "sky_template.wdl"). Press the x-key to generate the cubemap! Once the cubemap is generated, you can uncomment or erase the "include
All value names are pretty self-explanatory...just play with them!
All sky/weather values may be adjusted directly at the begining of the "sky_template.wdl" (see comments in the script)
Note: When "dynamic_day_night" is set to "0", the "fog_dynamic_day_night_off" fogcolor will be applied...set this value to your needs!
All object bound values (terrain. water, mood trigger...) can be adjusted via the bahaviour panel in WED...simply select the object you want to adjust, then right mouseclick->behaviour.
Some values (e.g. texture scales defined within a shader or ffp) can only be adjusted directly in the ffe/shader part of the sript, indicated in caps: "CHANGE THIS TO YOUR NEEDS"
Note: value names ending with "..._fac" should normaly be adjusted within the range 0-1.
After every value change you will need to buid the level with "update entities". The "save" on the behaviour panel doesen't update the values!
Note: When choosing random values for object (obj_template) such as "scale_random_fac" or "random_pan", the shadows (those you generate!) will not fit the object when restarting the level!
The terrain materials are to be found in the terrain_materials.wdl...to keep things tidy.
Note: If no values are set, some default values will be applied.
The waterplane (lake entity) needs to have a black 32bit tga as first entity skin. The size of this texture determines the shoremap resolution (512x512 should do!).
The river (river entity) only needs a black 32bit tga of 256x256 pixel.
Creating a black entity skin in MED is simple: Edit->Manage Skins->Add Skin (then click on the skin 1"skin0")->Skin Settings->then check "Texture"->Texture Format (e.g. 512x512 pixel, 32bit...ok) and save the waterplane.
When using geometricel wavemovement, the waterplane resolution should be at least 32x32 vertices....the higher the resolution the higher the wave frequency can be.
The terrains need the following texture setup (512x512 pixel is a good size...):
first entity skin = rgb-blendmap (must not contain an alpha channel!)
second entity skin = shadowmap (for better shadow generation, the shadowmap can be 1024x1024 pixel and later be resized to 512x512 pixel)
third entity skin = underwater caustics
fourth entity skin = underwater caustics (rotated 90')
Even though these are all entity skins, they need to be assigned from extern (e.g. from your texture folder). The underwater caustics textures are in the mm_textures folder.
Assigning extern entity textures in MED is simple: Edit->Manage Skins->Add Skin (then click on the skin 1"skin0")->Skin Settings->then check "Texture"->Texture File-> check "Extern" and load your first terrain skin (rgb-blendmap). Repeat this procedure to assigne all other skins. From these skins the shadowmap must be named "terr_shadowmap_1.tga". If you put a "_2" (or any number) instead of the "_1" at then end, this will be the shadowmap of the terrain with the according terr_id_number skill wich you can set in WED for each terrain (this procedure is needed due to the fallback ffe's from the terrains). The other entity skins (rgb-blendmap, caustics) may have any name.
Then you need six more terrain textures (the textures that are being tiled over the terrain according to the blendmap and a ffe-fallback-colormap and ffe-fallback-detailmap). These textures are being loaded from extern
and have a strict naming convention that must be as follows:
terr_red_1, terr_green_1, terr_blue_1, terr_black_1, terr_ffe_colormap_1, terr_ffe_detailmap_1
For a second terrain within your project, the names keep the same but with "_2" at the end. This way you can have multiple terrains...you will only have to create additional materials and ad some lines within the terrain action! The terrain action (act_terrain) chooses the material according to the terr_id_number skill wich can be set in the behaviour panel (number 1 chooses the material with all skins ending with "_1"...and so on).
Note: all skins have by default the .bmp format...exept from the shadowmap wich is in 32bit .tga (uncompressed).
Simply take a good look at the demo level to get familiar with this system...it's simple!
Make sure you have a shadowmap (e.g. the one exported and tga-32bit-converted from EarthSculptor) assigned as second entity texture to your terrain (remember the naming convention, e.g. "terr_shadowmap_1.tga").
Select your terrain in WED, right mouseclick->behaviour, check flag2(terr_shad_gen) to switche to shadowmap generation mode. Also make sure your terrain has an integer terr_id_number.
At the begining of the "terrain_template.wdl" you have the possibility to adjust:
var shadow_brightness=100; ...brightness of shadows...(0=black-255=white)
var shadow_pixel_z_adjust = -1; ...play with this within a range 0f -5 to 5! This affects the shadow offset from the object
var blur_passes = 1; ...the higher the softer the borders of the shadows
By pressing the g-key, a shadowmap of all objects on the terrain is being created and saved to the project folder.
Uncheck the terrain flag2 in WED when done.
Note: for generating the shadowmap, the "dynamic_day_night" option (in sky_template.wdl) will be stoped and you must set the sun_elevation/sun_azimuth manualy! It's all at the begining of the "sky_template.wdl"
Select your waterplane in WED, right mouseclick->behaviour, check flag3(lake_shore_generation)to switche to shoremap generation mode.
You can influense the shoremap-creation by adjusting the following lake entity WED skill values:
lake_shore_depth ...affects range of the shore-break
lake_shore_smoothness ...affects smoothness of the shore-break range
By pressing the h-key, the shoremap is being created and saved to the project folder.
Uncheck the flag3 in WED when done.
Note: A one pixel overall gausian blur in GIMP can improove the shoremap.
Note: The black/yellow/redish shoremap "lake_hlsl_shoremap_1.tga" (the "_1" at the end of the filename corresponds to the lake_id_number skill wich can be set in the lake bahaviour panel. This is needed to be able to use multiple waterplanes with different shoremaps) only works for the shader water. The ffe doesen't support the white shore-foam textures...but you can "soften" the shoreline by doing the following (using GIMP!):
If you don't need a soft shoreline, simply create a plain white tga image and name it to "lake_ffe_shoremap_1.tga". Without this image file, the ffp effect won't display...
Feel free to create funky effects by manipulating the shoremap in a paint-program :-)
Note: Generated shadowmaps and shoremaps will be saved to your main project folder...you are free to move them to any of your folders within the project folder (e.g. "texture") as long as you have a path to that folder in your main script. Please consider that in 3dgs version below 6.6., you might have to update the texture path of the terrain entity-textures (rgb-blendmap, shadowmap, caustics textures) in MED.
Important: Generate shoremaps/shadowmaps only one by one!
The underwater caustics are generated within the terrain shader and therefore need the shadowmap's alpha channel (because all other aviable skins in the shader are occupied!). So after you've baked your object shadows onto the terrain shadowmap and after you 've created the "lake_ffe_shoremap_1.tga" (because you will need it as a masking pattern...), you can do the following.
This tutorial explains how to use terrains made in EarthSculptor
Please use the EarthSculptor manual for building the terrain as this won't be described here.
When painting with textures in EarthScuptor the rgb-blendmap is created as follows:
(from left to right) texture in slot1 creates red in the rgb-blendmap, slot2 = green, slot3 = blue, slot4 = black.
After you saved your terrain in EarthSculptor, you will find the highmap (greyscale image without special filename ending), the blendmap (file ends with "_d0") and the shadowmap (file ends with "_0") in the "Maps" folder within the folder where Earthsculptor is installed.
To create the ffe-fallback colormap in EarthSculptor, do the following: In the lighting menu, set the "Ligh" slider to 0.00 and the ambient slider to 1...then generate. In the terrain menu, decrease the terrain hight to 1.00 using the "Hight" slider (this is to avoid distortion for screenshot!), take a screenshot from a precise top-down view in earthsculptor (Utilities-> Screenshot). Now you will have to precisely crop a power of two image (e.g. 512x512 pixel) in your umage software and save as .bmp (this is now the ffe fallback colormap!)
Open all the above mentioned image files in InfranView (http:www.irfanview.com/) or Windows-Paint (don't use other programs or else you 'll only see a transparent image for the rgb-blendmap) and resave them in .bmp format exept from the shadowmap wich must be converted from greyscale to rgb mode and saved as 32bit .tga (GIMP works perfect for that!)Converting from greyscale to rgb mode in GIMP: (Image->Mode->RGB)...then save as .tga (non compressed).
Note: Remember the texture naming convention described in the "Important information about texture setup" chapter!
Copy all textures you painted with in EarthSculptor (you can find them in the "Textures" folder within the folder where Earthsculptor is installed). Make sure the size of all textures is equal...best 512x512 pixel. If the textures by default have a different format than .bmp, resave them with an image program to the .bmp format.
Note: Remember the texture naming convention described in the "Important information about texture setup" chapter!
Then Import the highmap image into MED (File->Import->Import Terrain from Pic), adjust the terrain resolution by changingthe vertices amount (I usualy make it around 100x100 vertices).
Probable you will have to rescale the terrain in height (with the scale tool in MED) to fit it as close as possible to the original in "earthsculptor". Then assign the rgb-blendmap as first and the shadowmap as second skin to your terrain (Edit/Manage Skins, chose "New Skin" to setup more skins...mark the texture checkbox of each skin and load the mentioned texture for each skin).
Add the terrain to your level (Objec/Add Terrain) and assign the action "act_terrain" to it. You might want to adjust the tiling size of the textures by changing the values in the shader...see: "Out.Tex3 = inTexCoord0.xy*30; tiling texture red...".
Program used: The new free MED
Preparation: You nee to have a square background reference image in MED that shows the riverflow. This can be the rgb-blendmap or the ffe-fallback colormap or (if the riverflow is at sea-level) the generated shoremap. Also possible would be the original greyscale highmap.
Nils Dauman: www.ssmasters.de developpement assistance, shader-coding, testing
Thomas Oppliger: image writing/saving code wich is to be found in the 3dgs wiki
George Dan Pirvu: AUM code pieces included here
Josh Miller: Help with fog-fading code
3dgs community: kind people...cool dudes...helpfull answers ;-)
This is freeware! You may use all content included in "MystyMood" freely in your projects.
You may not sell the sources (scripts, models, textures) nor derivates of MystyMood in any way.
Credits to "loopix-project.com" is required (contact me if you can't give credits...we'll find a solution).
I don't take any responsability for any damage (financial loss, hardware damage, health damage etc.) caused by the use of "MystyMood" content.
All copyrights remain at www.loopix-project.com