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.

AppGameKit Classic Chat / How can i convert .x file material values to RGB

Author
Message
blink0k
Moderator
11
Years of Service
User Offline
Joined: 22nd Feb 2013
Location: the land of oz
Posted: 25th Apr 2017 23:15 Edited at: 25th Apr 2017 23:16
I have a .x file and the material is 0.690196 this represents a light blue color or 0xAFD6F6
I am having trouble getting from 0.690196 to 0xAFD6F6
When i multiply it by 1000000 and use hex to display the value i get 0x0A8814
Ultimately i want to set a sprites color using it

Attached is the .x file

Attachments

Login to view attachments
janbo
16
Years of Service
User Offline
Joined: 10th Nov 2008
Location: Germany
Posted: 25th Apr 2017 23:59 Edited at: 26th Apr 2017 00:03
The value 0.690196 is the first component of the color of the material you are looking for
It's the Red component followed by Blue,Green and Alpha...combined it is Lightblue Indeed

You want:



Using AGKv2 Tier1
blink0k
Moderator
11
Years of Service
User Offline
Joined: 22nd Feb 2013
Location: the land of oz
Posted: 26th Apr 2017 00:02 Edited at: 26th Apr 2017 00:04
Sorry. Didn't see your code
janbo
16
Years of Service
User Offline
Joined: 10th Nov 2008
Location: Germany
Posted: 26th Apr 2017 00:10 Edited at: 26th Apr 2017 00:11
hah that's because you could not ^^
Me: Edited at: 25th Apr 2017 12:03
You: Posted: 25th Apr 2017 12:02

if you want a singe color value just use

Using AGKv2 Tier1
janbo
16
Years of Service
User Offline
Joined: 10th Nov 2008
Location: Germany
Posted: 26th Apr 2017 00:31 Edited at: 26th Apr 2017 00:41
Also there are more who need Vertex Colors
Vertex Color
Load Object with Color

...And they ^ are the active part of our community
I'm sure there are much more in the silence/much bigger part.
I was one of them a long time ...before I started writing shaders.
I see every feature request as some sort of % ...sadly I don't know how many active/passive members TGC have or how many AppGameKit versions are sold
Maybe TGC/Paul should look into Vertex Colors if he finds some time

Maybe usefull sidenote:
In the documentary of Library AppGameKit uses to load the objects: Assimp
Quote: "if parts of the model use a different material, this part is moved to a separate mesh at the same node"

But it seems only the x format behaves like that

Using AGKv2 Tier1
blink0k
Moderator
11
Years of Service
User Offline
Joined: 22nd Feb 2013
Location: the land of oz
Posted: 26th Apr 2017 01:04
Attached is my progress with the kenny models.
Run the app and you will see the models loaded in agk with their colors
click right side of the screen for the next model, left side for the previous model
there a still quite a few models where the normals are haywire (i'll look a little further into that)

Attachments

Login to view attachments
janbo
16
Years of Service
User Offline
Joined: 10th Nov 2008
Location: Germany
Posted: 26th Apr 2017 21:33 Edited at: 27th Apr 2017 18:03
Well done
I tried to read the material color from the file, but instead of creating images from it I made a vertex color shader and didn't get the linkage between Vertex and Face working.
I also attached images to the mesh at some point but not like you.

Thank you
There is nothing left to stop me from creating an awesome 3D-top-down-multilayer-zombie-shooter

ps the "delim" parameter of the "GetAToken" function is somewhat redundant

Using AGKv2 Tier1
blink0k
Moderator
11
Years of Service
User Offline
Joined: 22nd Feb 2013
Location: the land of oz
Posted: 26th Apr 2017 22:02 Edited at: 26th Apr 2017 22:06
I posted an update in
Load Object with Color
Good luck with your project

Quote: "ps the "delim" parameter of the "GetAToken" function is somewhat redundant"

Haha. Silly me

Login to post a reply

Server time is: 2024-11-24 16:24:10
Your offset time is: 2024-11-24 16:24:10