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 / .x model not working with textures and/or shaders -possible solution.

Author
Message
Broken_Code
15
Years of Service
User Offline
Joined: 20th Aug 2010
Location: Bremen, Germany
Posted: 12th Feb 2012 19:16
Sorry to start a thread that I already know won't go very far but I've spent an age looking for the solution and eventually found it (this solution was posted by GreenGandalf in a thread about normal mapping, as far as I remember) I thought I'd give it a title that might turn up if someone searches for it! My problem was this:

My .x model would not display textures properly when additional texture levels were added and also wouldn't work with any shaders, I was using Evolved's lighting shader in particular.

Here's the solution:
My model had been unwrapped with Ultimate Unwrap3D which add some information to the file that makes it not work for some reason (I'm not really sure as to the reason, if someone could tell me I'd appreciate it ); you can tell if your object has been unwrapped like this by opening it in a text editor, it'll say something like this at the top:



To fix this simply add the line:

to your code after you load the object and as if by magic all is good again! I'm not sure about the numbers in this function call, it doesn't seem to be model-specific but perhaps it is usage specific? If you know, I'd love to hear it!

Thanks,
BC
Quel
17
Years of Service
User Offline
Joined: 13th Mar 2009
Location:
Posted: 12th Feb 2012 19:38
Your unwrapper program converts the file according to its own vertex format standards, which DBPro can't understand very much, so that line changes it back.

-Mental Hybrid: A unique heavy story based shoot'em ~40% (primary project)
-CoreFleet: An underground commander unit based RTS (canned) ~15%
Broken_Code
15
Years of Service
User Offline
Joined: 20th Aug 2010
Location: Bremen, Germany
Posted: 12th Feb 2012 20:01
Each unwrapper had it's own standards? so is the number (in this case 274) specific to the unwrapper then?

Thanks,
BC
Brendy boy
20
Years of Service
User Offline
Joined: 17th Jul 2005
Location: Croatia
Posted: 12th Feb 2012 20:24
Quote: "Each unwrapper had it's own standards?"

no

Quote: "so is the number (in this case 274) specific to the unwrapper then?"

no, 274 is default vertex format for dbpro objects

MrValentine
AGK Backer
15
Years of Service
User Offline
Joined: 5th Dec 2010
Playing: FFVII
Posted: 12th Feb 2012 20:57
WoW just WoW

This will be useful for me... if I remeber to look at it again

Broken_Code
15
Years of Service
User Offline
Joined: 20th Aug 2010
Location: Bremen, Germany
Posted: 12th Feb 2012 22:10
Thanks for the information! I have got one more question though:
Will any object work with DBP using the number 274?

Thanks,
BC
Chris Tate
DBPro Master
17
Years of Service
User Offline
Joined: 29th Aug 2008
Location: London, England
Posted: 12th Feb 2012 22:42
Here is my diagram of what the 274 means; taken from the memblock article.



It is an object without its diffuse (colour) set.

Broken_Code
15
Years of Service
User Offline
Joined: 20th Aug 2010
Location: Bremen, Germany
Posted: 12th Feb 2012 23:08
Ahhh, now I get it, thanks for the diagram, that was really helpful!

BC
Burning Feet Man
18
Years of Service
User Offline
Joined: 4th Jan 2008
Location: Sydney, Australia
Posted: 13th Feb 2012 04:23 Edited at: 13th Feb 2012 04:43
What's the work around to this problem when testing models in DarkShader V1.0?

EDIT: Below are some screenshots from DarkShader, my fire truck fresh out of 3DS Max, using Panda plugin to save as a .X file.



Here is DarkShader with a sphere and a snow shader loaded;



Changing from a sphere to my fire truck .x file, you can see the problem.



Help build an online DarkBASIC Professional help archive.
DarkBasic Help Wikia
Brendy boy
20
Years of Service
User Offline
Joined: 17th Jul 2005
Location: Croatia
Posted: 13th Feb 2012 05:17
Quote: "Changing from a sphere to my fire truck .x file, you can see the problem."

are you sure your truck has textures, it looks more like colors to me. If you load non textured object into dbpro and think you can't texture him afterwards (it doesn't have uv coords or something like that)

Chris Tate
DBPro Master
17
Years of Service
User Offline
Joined: 29th Aug 2008
Location: London, England
Posted: 13th Feb 2012 13:38
Quote: "it doesn't have uv coords or something like that"


Most certainly not, it does not have the correct UV coordinates. (You can see this using VertexData commands.)

Burning Feet Man
18
Years of Service
User Offline
Joined: 4th Jan 2008
Location: Sydney, Australia
Posted: 13th Feb 2012 23:21 Edited at: 13th Feb 2012 23:23
I must admit I'm a n00b when it comes to 3D models. Making all sorts of shapes is pretty straight forward (as per my fantastic looking fire truck), but getting them into the right format, texturing them, animating them... I've still got a lot of learning to do.

Not to forget shaders... then tying all of the above in actual working code, that runs smoothly, and that gamers find enjoyable!

... Why the hell did I chose game creation as a hobby!?

Help build an online DarkBASIC Professional help archive.
DarkBasic Help Wikia

Login to post a reply

Server time is: 2026-07-09 19:27:46
Your offset time is: 2026-07-09 19:27:46