Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

DarkBASIC Professional Discussion / mipmap texture problem

Author
Message
Ermes
23
Years of Service
User Offline
Joined: 27th May 2003
Location: ITALIA
Posted: 25th Jun 2010 10:19 Edited at: 25th Jun 2010 10:57
hi, i have a problem using mipmap texturing with dbpro, my texture is this:



when i enable mipmap texture, all the polygons of my objects are outlined with a thin but horrible line of white.

i haven't this image with me at the moment, sorry.

there is some options with mipmap texturing?? maybe in load object??
i only know about "set object texture nobject,texture mode,mipmap flag"

When i use AC3D, mipmap texturing of the object is perfect.

edit: just read some other post for mipmaps, how about a dds exporter or disabling filter texture, someone can help?
it's possible to have only 2 levels of mipmap?
thanks

ciao faccie da sedere!
Green Gandalf
VIP Member
21
Years of Service
User Offline
Joined: 3rd Jan 2005
Playing: Malevolence:Sword of Ahkranox, Skyrim, Civ6.
Posted: 25th Jun 2010 13:22
Have you tried turning off the mipmapping using set object filter?

That won't be ideal because you might get shimmering as the object moves around at certain camera distances.

Quote: "it's possible to have only 2 levels of mipmap?"


You probably need a shader to take control of that.

Have you tried changing the border colour to something like a reddish grey instead of white, i.e. use a colour which is similar to the average of all the colours you want to use (which is what mipmaps do in effect)?
James H
19
Years of Service
User Offline
Joined: 21st Apr 2007
Location: St Helens
Posted: 25th Jun 2010 14:13
If you really want reduced mipmap levels it can be done without shaders.http://eliteforce2.filefront.com/file/DDS_Converter;29412#Download
Ermes
23
Years of Service
User Offline
Joined: 27th May 2003
Location: ITALIA
Posted: 25th Jun 2010 14:23 Edited at: 25th Jun 2010 14:26
eh, to change the white is an idea, maybe the best way to resolve. now i control also the dds converter.

ciao faccie da sedere!
Ermes
23
Years of Service
User Offline
Joined: 27th May 2003
Location: ITALIA
Posted: 25th Jun 2010 14:29
dds converter say my textures isn't a power of 2!!! oh god...

ciao faccie da sedere!
Green Gandalf
VIP Member
21
Years of Service
User Offline
Joined: 3rd Jan 2005
Playing: Malevolence:Sword of Ahkranox, Skyrim, Civ6.
Posted: 25th Jun 2010 17:17 Edited at: 25th Jun 2010 17:19
Use DxTex.exe which comes with the MS DX9 SDK.

Here's a version of your image with two mipmap levels. [Since it's based on your original jpg image posted earlier there will probably be some loss of pixel quality.]
Ermes
23
Years of Service
User Offline
Joined: 27th May 2003
Location: ITALIA
Posted: 26th Jun 2010 10:01 Edited at: 26th Jun 2010 10:02
Thanks Green Gandalf, i used it for testing, you are very nice.

After that,
i've downloaded sdk from microsoft and the photoshop plugin for load/save dds, i edited manually the mipmap, but in fact, if i can't control the distance where mipmap is used, i.e. at what distance from camera i neeed to be on mipmap 2, then 3 etc etc, i lose too much in details, and the main texture is never used only in close range but is impossible to have ships so close at the camera.
the way can be deactivate mipmap at closerange, then when the ship is far enought, reactivate mipmap.... but here it is dbpro problem:
when i load an object.x with a dds texture, i don't need to write "set object texture n,0,1", then if object n<RangeToNotMipmap i have to write "set object texture n,0,0", after, wher object n is moving away, if object n>RangeToNotMipmap..... what i've to write? if i write "set object texture n,0,1" dbpro make a mipmap by itself and don't use the mipmap set i've created. i.e. i've a mipmap with 3 scale of details, dbro add other mipmapped scaled image i don't want to use. MIPMAP

ciao faccie da sedere!
James H
19
Years of Service
User Offline
Joined: 21st Apr 2007
Location: St Helens
Posted: 26th Jun 2010 13:17
When you load an image you can specify if it is to generate mipmaps.(load image ".dds",image number,texture flag) Load two versions of your image(one with texture flag 0 for mipmap generation, the other with texture flag 1 for no mipmaps) and instead of setting object texture you could retexture with the relevant one, at your preferred distance.
Green Gandalf
VIP Member
21
Years of Service
User Offline
Joined: 3rd Jan 2005
Playing: Malevolence:Sword of Ahkranox, Skyrim, Civ6.
Posted: 26th Jun 2010 13:58 Edited at: 26th Jun 2010 14:06
Good question. Would the set object filter command be more helpful?

Edit [Got interrupted while posting and forgot to refresh. so didn't see James H's post.] The problem is that it isn't clear when DBPro is using the existing mipmaps and when it is generating new ones - but James H's suggestion might work. The situation isn't helped by the confusing wording of the Help file entries. For example, this is what the entry says for set object texture

Quote: "SET OBJECT TEXTURE
This command will set different texture modes used by the specified object.

Syntax

SET OBJECT TEXTURE Object Number, Texturing Mode, Mipmap Flag

SET OBJECT TEXTURE Object Number, Stage Number, Texturing Mode, Mipmap Flag

Parameters

Object Number
Integer
The object number

Stage Number
Integer
Setting the Texture Wrap Mode to zero will use the default wrap mode which repeat the pattern of the texture over and over

Texturing Mode
Integer
The Mipmap Generation Flag is used to ensure the image has a mipmap texture

Mipmap Flag
Integer
Specify a value of zero to disable, and a value of one to enable.
"
Ermes
23
Years of Service
User Offline
Joined: 27th May 2003
Location: ITALIA
Posted: 27th Jun 2010 00:10
retexturing object over and over make my game runs like a turtle.
but i give it a try.

ciao faccie da sedere!
James H
19
Years of Service
User Offline
Joined: 21st Apr 2007
Location: St Helens
Posted: 27th Jun 2010 00:22
Quote: "i edited manually the mipmap, but in fact, if i can't control the distance where mipmap is used, i.e. at what distance from camera i neeed to be on mipmap 2, then 3 etc etc, i lose too much in details, and the main texture is never used only in close range but is impossible to have ships so close at the camera."

Each mipmap will start to blend with its neighbouring mipmap either just before or just after the textured face(s) match the same area in pixels on the screen as the mipmaps own area in pixels. The purpose of using mipmaps is to reduce the texture memory required to render a scene so as to reduce performance loss on the gpu - usually significantly in demanding scenes. In essence the more mipmaps have for an objects texture the better if you need to reduce performance loss; however you should consider that a large texture on an object on a screen with a low resolution, will only be in use/visible when the object is closest to the camera - if the image is larger than the screen resolution it may never be used at all. But you must also consider your objects uv`s use of texture area in pixels to determine what texture size you want to use/would be best for an object.

GG: it MIGHT work - though I`m not convinced that dbp doesn`t generate from the last level in the file for as far as it can(up to 8 mipmaps for dbp?). I can think of no way of testing other than perhaps by use of a specially written shader.(maybe look for a way in the shader to change to a different diffuse for each mipmap - without accidentally forcing the existence of mipmaps that are not in the file). I have been able to put 10 mipmaps in a texture(each a different color)(dbponly auto generates 8 I think I read on the forum somewhere - wonder how they worked that out?), but as I`ve mentioned I can`t think of a way to test dbp`s reaction to less than 8 in a file. It might be quicker to ask Lee, but then it might be more fun to find a way to manipulate mipmaps with a shader if possible; I remember there was a function for mipmapLODbias mentioned in dxsdk for hlsl but when I last tried doing something with it I failed.
James H
19
Years of Service
User Offline
Joined: 21st Apr 2007
Location: St Helens
Posted: 27th Jun 2010 00:32
Quote: "retexturing object over and over make my game runs like a turtle.
but i give it a try."

You would only retexture when required, not every loop. ie when the cameras distance from the object PASSES the point you require it to change.
Ermes
23
Years of Service
User Offline
Joined: 27th May 2003
Location: ITALIA
Posted: 27th Jun 2010 01:03 Edited at: 27th Jun 2010 01:21
yes it need a if then statment, but another problem is some of my objects are textured with two images, not one.

anyway i didn't understand how mipmap works for distances.
i make a test with different colorized mipmap and at different angle of rotation of the object, even at the same range from the camera, render engine change the mimpap on the faces.

area of surface to fill=area in pixel of the mipmap

a bit difficult to linearize, think it is in percent.

ciao faccie da sedere!
Green Gandalf
VIP Member
21
Years of Service
User Offline
Joined: 3rd Jan 2005
Playing: Malevolence:Sword of Ahkranox, Skyrim, Civ6.
Posted: 27th Jun 2010 01:18
Quote: "but then it might be more fun to find a way to manipulate mipmaps with a shader if possible"


I'm sure I've got a shader which does just that. I'll see if I can find it and adapt it to the present issue.
Ermes
23
Years of Service
User Offline
Joined: 27th May 2003
Location: ITALIA
Posted: 27th Jun 2010 01:22
oh well i'll be very happy of this.

ciao faccie da sedere!
James H
19
Years of Service
User Offline
Joined: 21st Apr 2007
Location: St Helens
Posted: 27th Jun 2010 04:24 Edited at: 27th Jun 2010 14:07
Just been messing around - set object texture works fine using your own edited dds file. If you set the mipmap flag to 0 then no mipmaps are used, with 1 the mipmaps are on but change instantly and with 2 the final image is a blend between them over distance. The only way that I could get dbp to overwrite existing mipmaps was by adding the texture flag value of 1 while loading the image; then set object texture generated its own, as only 1 level of mipmap was loaded and available for use,(when the flag was not set to 0). Helpfiles a little unhelpfull here.

edit: actually set object texture dooes not generate mipmaps and/or override existing ones; it just switches to existing ones if they are available.
Green Gandalf
VIP Member
21
Years of Service
User Offline
Joined: 3rd Jan 2005
Playing: Malevolence:Sword of Ahkranox, Skyrim, Civ6.
Posted: 27th Jun 2010 18:39
Quote: "edit: actually set object texture dooes not generate mipmaps and/or override existing ones; it just switches to existing ones if they are available. "


Thanks for confirming that - another Help file oddity for my list for Lee.
Ermes
23
Years of Service
User Offline
Joined: 27th May 2003
Location: ITALIA
Posted: 1st Jul 2010 12:07
i'm not of that way.
if i load an object textured with a dds image with only 2 levels of mipmap, my object works, without setting nothing 'bout mipmap. then if i write "set object texture n,0,1" dbpro create the remaining mipmaps (8 i think) and don't stop at the 2 mipmap in the file.

i've tested it.

ciao faccie da sedere!
James H
19
Years of Service
User Offline
Joined: 21st Apr 2007
Location: St Helens
Posted: 2nd Jul 2010 00:36
Quote: "and don't stop at the 2 mipmap in the file.
"

Yes this is the case; I meant override as in replace. Whatever your last mip level in the edited file is, dbp does appear to generate more if it can, but it doesn`t interfere with existing ones in the file. You will need to use a second texture loaded without mipmaps to get around this, at the distance your last mipmap level in the texture file appears to start to merge with the mipmap that is the next level down. Or you could use kaedrohos anistropic filtering dll in program anouncements as it may prove suitable for your purpose - using no mipmaps beyond a certain distance by retexturing will make pixels of the texture appear to `swim`. With anistropic filtering you can still use the mipmapped texture which hopefully would suit your needs.
I may have had my wires crossed - I thought you meant that set object texture had no affect at all for you.
Mighty Marcos
20
Years of Service
User Offline
Joined: 6th Mar 2006
Location: Massachusetts,USA
Posted: 2nd Jul 2010 00:45
Hi guys,

I am new to DBPro, but have been making games professionally for a few number of years.

The problem is not mipmapping, it's your uvs, they are prob too close to the white edges between areas of color, try getting rid of the white in your image all together, that should solve your problem.

Hope this helps.
Ermes
23
Years of Service
User Offline
Joined: 27th May 2003
Location: ITALIA
Posted: 2nd Jul 2010 01:55
oh yes,Mighty Marcos , for sure the texture is not the best to use with a mipmap, for the white area.
next time i start work better and focus my works to copy with mipmap and not mipmap copy with my works...

ciao faccie da sedere!
Ermes
23
Years of Service
User Offline
Joined: 27th May 2003
Location: ITALIA
Posted: 3rd Jul 2010 00:57
but one thing:

how ac3d can use mipmap from my texture and don't make any errors????????????????????????????????????????????????????????????



again: ????????????????????????????????????????????

ciao faccie da sedere!
James H
19
Years of Service
User Offline
Joined: 21st Apr 2007
Location: St Helens
Posted: 3rd Jul 2010 03:33
There are a lot of issues with a number of modeling software exports for dbp. What is really needed is a WYSIWYG editor. Doesn`t mean though that its not possible - many, many users have had great success with different software. Having looked at the recommended specs for this piece of software I think it could be a compatability issue. The only suggestion I can think of at this time is to utilise the scale object texture command with a value of 0.99999 to start with - though the accuracy of a float may not be enough or may be too much. Or maybe even try exporting to other file formats that dbp supports(see help files for load object). All this said it might just be easier to change the uvs as suggested by Marcos - which should just be a case of selecting all uv`s and scaling down by the smallest value that ac3d will allow - ie 99.9%
James H
19
Years of Service
User Offline
Joined: 21st Apr 2007
Location: St Helens
Posted: 5th Jul 2010 00:03 Edited at: 5th Jul 2010 00:05
Just messin round again and found that you can set the maxmiplevel aswell as the mipmaplodbias in the sampler part of the fx shader. Can`t post the shader as I altered the default shader in darkshader but it will work in any shader I think. (Ermes - you dont need to use the maxmiplevel part as level 0 is mipmap 0 which is default anyway - just omit from code - just thought to add it in case any one finds it usefull for quality settings);
Tweakables:

Sampler:

No need to be concerned with additional mipmap levels dbp generates past the last level of your edited dds file, as long as the lod bias value is at the right negative value for you, they won`t come into play until long after the texture is to far away too show any detail.
Link102
21
Years of Service
User Offline
Joined: 1st Dec 2004
Location: On your head, weeeeee!
Posted: 5th Jul 2010 00:23 Edited at: 5th Jul 2010 00:26
sorry for not reading the entire topic and possibly repeating someone

1) Why don't you try a dds texture format, that way you can control the mipmaps and everything else. Get it here

2) Let the colors on your texture bleed into the white.

3) set object texture obj nr, texturing mode, mipmap flag
set teh texturing mode to 1 or 2.

Green Gandalf
VIP Member
21
Years of Service
User Offline
Joined: 3rd Jan 2005
Playing: Malevolence:Sword of Ahkranox, Skyrim, Civ6.
Posted: 5th Jul 2010 00:30
Useful suggestions, thanks.

I didn't know about that feature. It works nicely.

Login to post a reply

Server time is: 2026-07-25 06:44:41
Your offset time is: 2026-07-25 06:44:41