Time to create a command line feature to change my imposter tree. Here is the command line parameter in the batch file:
bM_WorldGraphics "Data\snowtexture.png,Data\snowdetail.png,G:\BM\SFFiles\EntityData\Trees\TreeNoLeaves\TreeNoLeaves.dbo"
and here is the parser now
If cl$() <> ""
Split String Unquote$(Trim$(cl$())), ","
Select Split Count()
Case 1
TerrainParameter$(1) = Split Word$(1)
QLg("Using terrain images: " + TerrainParameter$(1) )
Endcase
Case 2
TerrainParameter$(1) = Split Word$(1)
TerrainParameter$(2) = Split Word$(2)
QLg("Using terrain images: " + TerrainParameter$(1) + " & " + TerrainParameter$(2) )
Endcase
Case 3
TerrainParameter$(1) = Split Word$(1)
TerrainParameter$(2) = Split Word$(2)
ImposterModel$ = Split Word$(3)
QLg("Using terrain images: " + TerrainParameter$(1) + ", " + TerrainParameter$(2) + " and basic tree model: " + ImposterModel$ )
Endcase
Endselect
Endif
Let's take a look:
Cool, now let's leave the snow for now. Back to the grassland, I want to work on the trees.
Trees and water
So far the trees have looked really dark. I will switch off the lighting, using {Set Object Light n, 0} to see how they will look:
Right, so they need to be normalized; using {Set Object Normals}. This is the new result:
The trees now look more colourful, but there is something bothering me. I don't like the way the water is so reflective. In this still image, the animation is not visible so it makes it difficult to tell that the right half of the image is water. I want to know whether I am looking at water or grass pretty easily, so let's make the water more distinguishable. I have used an old water shader by Evolved because it fits my needs, there are more realistic water shaders out there, but SF will not be made to look photo-realistic; rather it uses graphics to distinguish significant entities from the insignificant; making it easier see game related items.
I will add the following lines to the Water.fx shader
texture WaterbumpHint <string Name=""; >;
sampler2D WaterbumpHintSamp=sampler_state
{
Texture = <WaterbumpHint>;
MagFilter = Linear;
MinFilter = Point;
MipFilter = None;
};
. The sampler and
return float4(Water,Mask)+(tex2D(WaterbumpHintSamp,IN.Tex0)*0.4);
the return value for the pixels, at the end of the pixel shader function which adds the a new texture at 0.4 (40%) opacity.
Now I can add a new texture layer; which will be a blue image with some caustics effects.
Let's see the result:
Ok, now the water is more noticeable, but I forgot to scale the hint texture. I will multiply the UV coordinates (called IN.Tex0) by 32. This is a bad habit, because this multiplication is being done on every pixel on every frame by the graphics card; a constant value would be better; but for now this will suffice, because it will not affect my framerate by noticeable amount in this phase.
return float4(Water,Mask)+(tex2D(WaterbumpHintSamp,IN.Tex0*32)*0.4);
OK, the scale is fine for now. But the highlights are too bright; I will reduce the highlights in the hint texture manually.
OK, that will do for now. Again, most texturing will take place after the basis of the engine is ready; so no need to go over board here.
TreeParty + Imposters
I have added a few tree parties into the scene. These animate and have their own level-of-detail system (LOD) which alters their quality according to your distance from them. I have also programmed a system which turns them into imposters at medium distance. The imposters look better so far than the medium distance tree party billboards.I get can a number of them to run, but then I get a full group error with Dark Imposters. I will just use tree party independantly for now and get back to fixing the error later.
Terrain Type
The player will need to take note of the terrain they plan to cross or race in; or play on; according to their profession. Terrains affect their characters ability to move and interact with them. To display this I will need to code in a terrain display hint using some images and the Blitz Terrain environment map.
First let's get my cursor and no-nonse check box in the program. I have posted some of the checkbox code for those who wish to use it, there are some self explanatory functions and types you would need to create to get it to work.
//========================================================
Function QuickImageCheckBox(x,y,tImageButtonSet as ActivationSetType,bChecked as Boolean)
bChecked = ImageCheckBox(x,y,tImageButtonSet.Icon,tImageButtonSet.OnImage,tImageButtonSet.HoverImage,tImageButtonSet.OffImage,tImageButtonSet.SwitchImage,tImageButtonSet.Scale#,tImageButtonSet.IconScale#,tImageButtonSet.OffSound,tImageButtonSet.OnSound,bChecked,"")
Endfunction bChecked
//========================================================
Function ImageCheckBox(x,y,iIcon,iOnImage,iHoverImage,iOffImage,iSwitchImage,fScale#,fIconScale#,iOnSound,iOffSound,bChecked as Boolean,sOnSwitchEvent$)
iw# = Image Width(iIcon)
ih# = Image Height(iIcon)
iw# = iw# * fIconScale#
ih# = ih# * fIconScale#
If bChecked
w# = Image Width(iOnImage) * fScale# : h# = Image Height(iOnImage) * fScale#
ix = x + ( Image Width(iOnImage) * 0.5 * fScale# )-(iw#*0.5)
iy = y + ( Image Height(iOnImage) * 0.5 * fScale# )-(ih#*0.5)
If MouseWithin(x,y,w#,h#)
If MouseUp(1)
a2DrawImage iOffImage, x+1, y+1, 0, 0, 0, fScale#, 0, 0xFFFFFFFF ` Use 0xFFFFFFFF for fully opaque image with no tints
bChecked = 0
If sOnSwitchEvent$ <> ""
Call Function Name sOnSwitchEvent$, bChecked, iIcon
Endif
If SoundExist(iOffSound)
If Sound Playing(iOffSound) = 0
Play Sound iOffSound
Endif
Endif
Else
a2DrawImage iHoverImage, x, y, 0, 0, 0, fScale#, 0, 0xFFFFFFFF
EndIf
a2DrawImage iIcon, ix, iy, 0, 0, 0, fIconScale#, 0, 0xFFFFFFFF
Else
a2DrawImage iOnImage, x, y, 0, 0, 0, fScale#, 0, 0xFFFFFFFF
a2DrawImage iIcon, ix, iy, 0, 0, 0, fIconScale#, 0, 0xFFFFFFFF
Endif
Else
w# = Image Width(iOffImage) * fScale# : h# = Image Height(iOffImage) * fScale#
ix = x + ( Image Width(iOnImage) * 0.5 * fScale# )-(iw#*0.5)
iy = y + ( Image Height(iOnImage) * 0.5 * fScale# )-(ih#*0.5)
If MouseWithin(x,y,w#,h#)
If MouseUp(1)
a2DrawImage iSwitchImage, x+1, y+1, 0, 0, 0, fScale#, 0, 0xFFFFFFFF
bChecked = 1
If sOnSwitchEvent$ <> ""
Call Function Name sOnSwitchEvent$, bChecked, iOnImage
Endif
If SoundExist(iOnSound)
If Sound Playing(iOnSound) = 0
Play Sound iOnSound
Endif
Endif
Else
a2DrawImage iHoverImage, x, y, 0, 0, 0, fScale#, 0, 0xFFFFFFFF
EndIf
a2DrawImage iIcon, ix, iy, 0, 0, 0, fIconScale#, 0, 0x90FFFFFF ` A little bit more transparent when off(90 is lower than FF; the first two represent alpha)
Else
a2DrawImage iOffImage, x, y, 0, 0, 0, fScale#, 0, 0xFFFFFFFF
a2DrawImage iIcon, ix, iy, 0, 0, 0, fIconScale#, 0, 0x80FFFFFF
Endif
Endif
Endfunction bChecked
. There are some great GUI plugins out there that I intend to use; however, in this situation I felt like using my own checkbox which will sit in my core library.
I will create a new test texture with a bit more stone and mud for the terrain, and a new .bat file to pick my settings; and here is the result:
Not quite the best terrain to drive an ATV on, but it will be difficult to catch your flag climbing through this.