Introduction

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!).


Features

Sky
  • dynamic day/night cycle
  • sun consiting of several elements (sun, sun-corona, sunshine)
  • high quality lensflare effect (20 elements)
  • dynamic moon (no phases yet...)
  • multi layered dynamic clouds (influenced by weather state)
  • daytime dependent dynamic changes of fog-color/sun-color/sky-color (dusk, dawn, day, night)...fully adjustable

  • night_1 (21K)

    Weather
  • weather system (featuring rain, snow, lightning thunder, clouds and wind)
  • smooth fadings of weather changes (including sounds)
  • option to morph rain into snow on specific altitudes
  • smooth dynamic weather fog
  • adjustable random weather change frequency
  • option to setup local mood/weather triggers that will temporary change the global mood/weather values when camera/player is within trigger-range

  • snow_1 (31K)
    mood_1 (35K)

    Terrain
  • guidelines on how to use terrains made in EarthSculptor(you can get EarthSculptor free at http://www.earthsculptor.com)
  • multitexture terrainshader featuring 4 textures plus shadowmap, reacts to sunlight and dynamic lights
  • fully adjustable mood/color tints, sunlight/fogcolor influence...
  • script that can easyly be setup for multiple terrains in your game (trough automaticaly selecting materials/textures according to terrain-ID skills)
  • hadles mdl and hmp terrains (also chunked terrains), contains ffp fallback (colormap/detailmap/shadowmap)
  • automatic baking of level-object shadows into the shadowmap (by pressing a single key!)...those shadows will remain static

  • sunset_1 (48K)

    Water
  • fast cubic-environment or realtime(A7 com.) reflection. including reflection-cube generation script
  • guidlines on how to setup dynamic underwater-caustics (wave-sunreflections)
  • dynamic shore-break according to water-depth...generated by pressing a single key
  • smooth shoreline fadeout...adjustable
  • fully adjustable mood/color tints, sunlight/fogcolor influence...
  • contains ffp fallback for low end hardware
  • mini tutorial on how to create flowing rivers (direction orientated) with cubic-enviromental or realtime(A7 com.) reflection shader applied and soft borders
  • adjustable waterfall either using ffp or particle technique...including bottom spray effect

  • reflections_1 (18K)
    waterfall_1

    Objects
  • simple objec placement script with many usefull adjustments (places single opjects)...material LOD, collision range setting, distance fade in/out, scale factor, random scale factor, z-position adjustment, pan angle setting, random pan setting, adjustable wind movement, option to set object to floor normal -90, material setups (for alphatransparent vegetation or solid objects)...
  • for more complex object settings (seed_map support, large vegetation, saving object positions to textfile...) I recomend "SEED_IT" from gameus.de


  • Other
  • option to use soft fading ambiente sounds (day,night,underwater...)
  • plus all textures that are needed within the MystyMood Template (of course they can be exchanged!)
  • plus all artwork that comes with the MystyMood demo



  • How to get it to work

    1. copy the mystymood_data folder and the mystymood.wdl into your project folder
    2. include mystymood.wdl at the begining of your main wdl: include <mystymood.wdl>;
    3. 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 ;".

    4. resave your main wdl and start your level and assigne the appropriate actions to the objects (waterplane, terrain, mood triggers, objects...)

    How to adjust the values

    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!

    sed_template_1

    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.

    behaviour_1


    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.




    About texture setup

    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!




    Creating a shadowmap

    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"


    shadowmapping_1 (29K)


    Creating a shoremap (sea-foam)

    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!):

    1. open the yellowish shoremap in GIMP
    2. add an alpha-channel (Layer->Transparency->Add Alpha Channel)
    3. select the the yellow area with the "Select regions by color" tool
    4. "grow" the selection to about the redish border (Select->grow...some pixels)
    5. clear the selected area (Edit->Clear)
    6. invert the selection (Select->Invert)
    7. fill the new selection with white color (Edit->Fill With FG Color)
    8. save the image as "lake_ffe_shoremap_1.tga" (again...the "_1" at the end of the filename corresponds to the lake_id_number...)

    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!




    Creating underwater caustics

    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.

    1. open the shadowmap (e.g. "terr_shadowmap_1.tga") in GIMP
    2. add an alpha channel (Layer->Transparency->Add Alpha Channel)
    3. add a layer mask (Layer->Mask->Add Layer Mask...initialize the mask to Layer's alpha channel)
    4. display the layer mask (Layer->Mask->Show Layer Mask) and make sure that it is black (if it's not you have to do it)
    5. now open "terr_ffe_shoremap.tga" in GIMP
    6. select it (Selec->All) and copy the selection (Edit->Copy)
    7. now you switch back to the black layer mask of the shadowmap image and paste what you've copied (Edit->Paste)
    8. anchor the pasted layer (Layer->Anchor Layer)...now you should have a black 'n' white mask image
    9. save the image as non RLE compressed tga image...now you have a hidden blendmap in the shadowmap to blend the undewater caustics wich also still serves as a shadowmap trough the rgb channels

    caustics_1 (20K)


    Minitutorial: Importing terrains from EarthSculptor(v.0.25)

    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...".




    Minitutorial: Creating Rivers in MED

    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.

    1. open the terrain (the one where the river is going to be...) in MED
    2. select the terrain (faces) and create a group (Edit->Select All->)...(Edit->Create Groupe)
    3. setup the riverflow reference image...one of those mentioned above (View->Background Texture...) load the image, check view-xy, auto and center...adjust x-scale/y-scale so that the background texture fits exactly the borders of the terrain (this is the most anoying part because you always have to click on "set" to see the result...until it fits)
    4. select the entire terrain and make it invisible (Edit->Select All->then click the "hide selection" icon...make sure both, vertices and faces are hidden
    5. merge-in the mm_river base-model (it's in the "mystymood_data/models" folder)...(File->Merge)
    6. Select the river (faces) and create a group (Edit->Select All->)...(Edit->Create Groupe)
    7. copy and paste the river piece
    8. build the riverflow according to your reference image...by pasting the copied river pieces and by shifting single vertices to get the bendings (make the river flow wide enough so that it won't float within the river bed)...now weld the two end-vertices of your connecting river pieces by selecting them and clicking the "weld" icon (if it doesen't work, it might help to first group all river pieces to one sigle group).

    9. riv_1
      riv_2


    10. select all faces from the river pieces exept from the two last triangles on each river end

    11. riv_3


    12. launch the skin editor (File->Skin Editor) and shrink the selected faces a bit (in vertical mode)...just to get them away from the texture-space border (because only the river endings need to cover the river-texture-fadeout...just to avoid hard edges)

    13. riv_4


    14. when done with the river, make sure all of the river is deselected (Edit->Selct None)...unhide the terrain (click the "show all" icon)...select the terrain (with goup select mode)...check if the river is at the right place (might need some adjusting)...when done, delete the terrain (don't delete the river!)...also delete all terrain skins (not the river skin!)...(Edit->Manage Skins...then select each terrain skin and delete it
    15. save the river with a new name (File->Save AS...)
    16. Add the river to your level in WED and make sure it hase the same scale and position as the terrain.



    Credits

    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 ;-)




    Terms of use

    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