Gamestudio Links
Zorro Links
Newest Posts
zorro 64bit command line support
by 7th_zorro. 04/20/24 10:06
StartWeek not working as it should
by jcl. 04/20/24 08:38
Data from CSV not parsed correctly
by jcl. 04/20/24 08:32
Zorro FIX plugin - Experimental
by jcl. 04/20/24 08:30
folder management functions
by VoroneTZ. 04/17/24 06:52
lookback setting performance issue
by 7th_zorro. 04/16/24 03:08
Zorro FIX plugin - Experimental
by flink. 04/14/24 07:46
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
1 registered members (7th_zorro), 529 guests, and 2 spiders.
Key: Admin, Global Mod, Mod
Newest Members
EternallyCurious, howardR, 11honza11, ccorrea, sakolin
19047 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Page 1 of 2 1 2
terrain #103016
12/20/06 17:38
12/20/06 17:38
Joined: Dec 2005
Posts: 414
Munich, Germany
R
Robotronic Offline OP
Senior Member
Robotronic  Offline OP
Senior Member
R

Joined: Dec 2005
Posts: 414
Munich, Germany
Hello!
Iīve got a question about chunked terrain.
For a very large outdoor area I would like to use several different chunked terrain entities, and wanted to ask if this is possible /recommended.
Basically I already tested this, it works fine, but Iīm not 100 percent sure if it is rendered as chunked or non-chunked.
I ask this. because the manual (in the entity chapter) says: "The catch is that a chunked terrain can't be put multiple times in the level ...", and now I am a little bit unsure. Does this mean, that I should use only one chunked terrain in a level?

Another thing - Iīm not sure if someone has already mentioned: I heve the impression, that the multitexture shader from the templates (A6.50) doesnīt switch to mipmaps for the red and green channel. The texture that I use, where the color map is black works fine. I tested this with different textures, formats and terrains. Maybe I have do do something with bitmap_to_mipmap?
Thanks for looking into this ...

Re: terrain [Re: Robotronic] #103017
12/21/06 17:46
12/21/06 17:46
Joined: Jul 2000
Posts: 27,982
Frankfurt
jcl Offline

Chief Engineer
jcl  Offline

Chief Engineer

Joined: Jul 2000
Posts: 27,982
Frankfurt
You can use multiple chunked terrains as long as they are different. You can not use two chunked terrain entities that have the same terrain file.

The mipmap processing occurs before the shader stage. Thus a shader has no influence on whether mipmaps are used or not.

Re: terrain [Re: jcl] #103018
12/21/06 22:34
12/21/06 22:34
Joined: Dec 2005
Posts: 414
Munich, Germany
R
Robotronic Offline OP
Senior Member
Robotronic  Offline OP
Senior Member
R

Joined: Dec 2005
Posts: 414
Munich, Germany
Fine, Iīm glad to hear this, especially about the chunked terrain. Now I just have to figure out, how I can proceed with my mipmaps. Maybe bitmap_to_mipmap will work.
Thanks, and a nice christmas to all Conitecs!

Re: terrain [Re: Robotronic] #103019
12/22/06 10:50
12/22/06 10:50
Joined: Jan 2003
Posts: 4,615
Cambridge
Joey Offline
Expert
Joey  Offline
Expert

Joined: Jan 2003
Posts: 4,615
Cambridge
but beware since these bitmap functions are rather slow, even though they might write directly to the grapics memory (do they?).

Re: terrain [Re: Joey] #103020
12/22/06 11:19
12/22/06 11:19
Joined: Dec 2005
Posts: 414
Munich, Germany
R
Robotronic Offline OP
Senior Member
Robotronic  Offline OP
Senior Member
R

Joined: Dec 2005
Posts: 414
Munich, Germany
Well, basically I created the mipmaps already in MED, when I was seting up the skins. But somehow they donīt show up. Maybe I missed something, but MED tells me, that all my skins have mipmaps.
I was looking into other multitexture code, and in one case, for example it is done like this:

bmap tex3 = <Landstrasse.tga>; // Texture Layer Red
bmap tex4 = <Fels.tga>; // Texture Layer Green
bmap tex5 = <FelsB.tga>; // Texture Layer Blue
bmap tex6 = <Grasboden.tga>; // Texture Layer Black


function multirgb_roughness() {
bmap_to_mipmap(mtl.Skin1);
bmap_to_mipmap(mtl.Skin2);
bmap_to_mipmap(mtl.Skin3);
bmap_to_mipmap(mtl.Skin4);

}


material multirgb {
flags = tangent;
skin1 = tex3;
skin2 = tex4;
skin3 = tex5;
skin4 = tex6;

event=multirgb_roughness; // here the mipmaps are created ...

effect
" //...

Maybe I can adapt this to the template code. The material from the templates however works a little bit different, since it uses internal skins from the terrain entity, so they should already be there? I like this shader, because it works so well with sun_color and lighting ...

Re: terrain [Re: Robotronic] #103021
12/22/06 16:30
12/22/06 16:30
Joined: Jan 2003
Posts: 4,615
Cambridge
Joey Offline
Expert
Joey  Offline
Expert

Joined: Jan 2003
Posts: 4,615
Cambridge
it's ok to use the functions only once, shouldn't produce much overhead.

Re: terrain [Re: Joey] #103022
01/07/07 20:10
01/07/07 20:10
Joined: Dec 2005
Posts: 414
Munich, Germany
R
Robotronic Offline OP
Senior Member
Robotronic  Offline OP
Senior Member
R

Joined: Dec 2005
Posts: 414
Munich, Germany
Thanks, Joey, a little late. I now tested my combination idea and after lots of try and error, I found a way. The framerate loss wasnīt dramatic, but I didnīt do exact research here.

Maybe other people also want to have mipmaps in combination with the template shader, so here is a little step by step description. Of course the main credit goes to the authors of these other codes, from which I was borrowing the missing parts:

1) Copy mtlFX.wdl and default.fx into your gamefolder.
2) I used external skins for the terrain, only the RGB-blendmap remains part of the terrainentity. I deleted the three texture skins in MED.
3) Changes in mtlFX.wdl:
3.1) At the beginning of this script under these lines of code ...

ifndef mtlFX;
define mtlFX;

... I inserted and modified:

Code:
 
bmap tex1 = <Grasboden.tga>; //Texture black
bmap tex2 = <Landstrasse.tga>; //Texture red
bmap tex3 = <FelsB.tga>; //Texture green

function multimip()
{
bmap_to_mipmap(mtl.Skin1);
bmap_to_mipmap(mtl.Skin2);
bmap_to_mipmap(mtl.Skin3);
}

MATERIAL mtl_terraintex3
{
skin1 = tex1;
skin2 = tex2;
skin3 = tex3;

event = multimip;

effect = " //...



3.2) Now in the effect string I changed ...

Texture entSkin1; // Red/green for blending, blue for shadow
Texture entSkin2; // Basic tiled terrain texture
Texture entSkin3; // Red masked tiled texture
Texture entSkin4; // Green masked tiled texture

... simply into this:

Texture entSkin1; // Red/green for blending, blue for shadow
Texture mtlSkin1; // Basic tiled terrain texture
Texture mtlSkin2; // Red masked tiled texture
Texture mtlSkin3; // Green masked tiled texture

3.3) Then I added some instructions to the mysterious sampler part. Normally itīs only like this:

sampler sMaskTex = sampler_state{Texture = <entSkin1>;};

I changed all the sampler stuff into something, that somehow seemed to help the mipmaps:

Code:


sampler sMaskTex = sampler_state // MORE FROM BOB
{
Texture = <entSkin1>;
MipFilter = Linear;
MinFilter = Linear;
MagFilter = Linear;
};
sampler sBaseTex = sampler_state
{
Texture = <mtlSkin1>;
MipFilter = Linear;
MinFilter = Linear;
MagFilter = Linear;
};
sampler sRedTex = sampler_state
{
Texture = <mtlSkin2>;
MipFilter = Linear;
MinFilter = Linear;
MagFilter = Linear;
};
#ifdef GREENMASK
sampler sGreenTex = sampler_state
{
Texture = <mtlSkin3>;
MipFilter = Linear;
MinFilter = Linear;
MagFilter = Linear;
};



As everyone can see, I simply changed the names from entSkin into the mtlSkin, where it was convenient and I put in many MinFilters, MipFilters and MagFilters.

3.3) Now in the action fx_terraintex3() (can be found directly below the materialdefinition) there also have to be some changes. I noticed for example, that the mipmaps want my.dynamic to be on, so I would recommend to comment out the last instruction. Some other lines should also be modified ( because the number of entity skins is now different (only one in my test).
For reference, this is what I did:
Code:
  

action fx_terraintex3()
{
// use skin 5 for non-shader hardware
// if (d3d_shaderversion < 1111) {
// if (ent_skins(my) >= 5) { my.skin = 5; }
// return;
// }

// if entity skins are missing, replace them by standard skins
mtl = mtl_terraintex3;
my.material = mtl;
// if (ent_skins(my) < 4) { mtl.skin4 = bmap_create("rock.tga"); }
// if (ent_skins(my) < 3) { mtl.skin3 = bmap_create("sand.tga"); }
// if (ent_skins(my) < 2) { mtl.skin2 = bmap_create("grass.tga"); }

// copy the texture scales to vecSkill41
if (my.skill2) { my.skill41 = float(my.skill2); }
else { my.skill41 = float(15); }
if (my.skill3) { my.skill42 = float(my.skill3); }
else { my.skill42 = float(15); }
if (my.skill4) { my.skill43 = float(my.skill4); }
else { my.skill43 = float(15); }

// my.DYNAMIC = OFF; // when all done, set terrain static
}




Thatīs the action without safety nets. I hope I didnīt forget something, but thatīs it. I tested everything, and it seemed to work fine. Since I am an absolute shader noob it is very well possible, that not every magfilter is really needed or that there isnīt a better or more simple way to enjoy multitexture in connection with mipmaps. If a more experienced user has some ideas, please feel free to comment ...

Re: terrain [Re: Robotronic] #103023
01/08/07 13:01
01/08/07 13:01
Joined: Jul 2000
Posts: 27,982
Frankfurt
jcl Offline

Chief Engineer
jcl  Offline

Chief Engineer

Joined: Jul 2000
Posts: 27,982
Frankfurt
This works, but I would not recommend that. A much easier way - without any code changes - is clicking the "Mipmaps" checkbox in MED skin settings. It then also loads faster.

For external textures the skin settings have no effect, but you can then use DDS textures with mipmaps.

Re: terrain [Re: jcl] #103024
01/08/07 18:48
01/08/07 18:48
Joined: Dec 2005
Posts: 414
Munich, Germany
R
Robotronic Offline OP
Senior Member
Robotronic  Offline OP
Senior Member
R

Joined: Dec 2005
Posts: 414
Munich, Germany
Thanks again for looking into this.
Actually thatīs what I did, before I started this research project: I loaded all the skins with the skin manager in MED, the mipmap checkbox was checked by default, and I expected the mipmaps to show up in the engine. For normal models this works fine, but I tested this with different terrains and texture formats (512*512, .tga and DDS with internal mipmaps) but only the first terrain texture (the second skin) was using the mipmaps. The textures that are used for the red and green parts of the RGB map appeared too sharp (pixelig) in the distance.

Actually I would prefer the more simple way, it would be also much more flexible, but I have no idea, why the mipmaps donīt show up.
Maybe I should try the .bmp format? Or maybe I missed something, when creating the mipmaps? Any ideas are welcome ...

PS: I use A 6.50.2 and a Radeon X850XT videocard

Last edited by Robotronic; 01/08/07 18:56.
Re: terrain [Re: Robotronic] #103025
01/09/07 11:07
01/09/07 11:07
Joined: Jul 2000
Posts: 27,982
Frankfurt
jcl Offline

Chief Engineer
jcl  Offline

Chief Engineer

Joined: Jul 2000
Posts: 27,982
Frankfurt
Maybe you used non-mipmap DDS textures for internal skins? The mipmap checkbox only creates mipmaps for PCX, BMP, or TGA textures. DDS textures are expected to already contain mipmaps.

For the rendering it should not make any difference whether the mipmaps are created by MED, by the DDS paint program, or afterwards by bmap_to_mipmap. The latter has only the disadvantage of slower loading and more code.

Page 1 of 2 1 2

Moderated by  old_bill, Tobias 

Gamestudio download | chip programmers | Zorro platform | shop | Data Protection Policy

oP group Germany GmbH | Birkenstr. 25-27 | 63549 Ronneburg / Germany | info (at) opgroup.de

Powered by UBB.threads™ PHP Forum Software 7.7.1