Results 1 to 15 of 15

Thread: Item ID

  1. #1
    Registered User
    Join Date
    Feb 2003
    Location
    Cumbria UK
    Posts
    419

    Item ID

    I'm playing around with dp's item info Node, using the Item ID to affect the colour of a surface. Everything was going well, until I noticed that soem combination of cloning produces an item number with a letter rather than just digits...

    For example, I get loads of items loaded as:
    LoadObjectLayer 1 10000000
    LoadObjectLayer 1 10000001
    LoadObjectLayer 1 10000002, etc...
    But I have also found I am geting some objects loading as:
    LoadObjectLayer 1 1000000b
    LoadObjectLayer 1 1000000c, etc..

    These objects don't play ball with the Item ID node, so I'd like to know how to avoid creating them.

    I haven't been able to work out reliable steps to reproduce this yet, but wondered if any scripting folks can shed any light...

    cheers,

    Derek

  2. #2
    TrueArt Support
    Join Date
    Feb 2003
    Location
    Poland
    Posts
    7,900
    Item id is not decimal, but hexadecimal. Valid digits are 0...9 and a...f. a = 10, b= 11, etc. until f.

  3. #3
    Registered User
    Join Date
    Feb 2003
    Location
    Cumbria UK
    Posts
    419
    Ahhhh.. that makes sense now. Cheers sensei..

    So is there any way to make DPs Item ID to make use of the IDs with letters in them?
    Like some way within nodes to convert a hexadecimal ID number to a decimal?

    This isn't causing any production problems, I'm just playing around with some new ideas...

    Derek

  4. #4
    TrueArt Support
    Join Date
    Feb 2003
    Location
    Poland
    Posts
    7,900
    It doesn't matter whether you write f.e. 240 or 0xF0 or $F0 or %11110000, it's still the same value regardless of visual presentation.
    Use scientific calculator to convert hex to dec and vice versa. Built-in WinXP calculator is fine, just enable extended mode.

    With ItemID/Clone Index people usually use gradient. Different id, different color/scalar which is driving some other stuff.

    I have never used DP, but TrueArt's Node Library http://www.trueart.eu Extended Item Info has Clone Index, that's extracting digits from cloned item name, and give it back in Node Editor. This way they start at 1. If you have couple cloned source objects, they will be in same range, and you won't have to remember from what values they start as ItemID.
    Last edited by Sensei; 02-10-2010 at 09:18 AM.

  5. #5
    obfuscated SDK hacker Lightwolf's Avatar
    Join Date
    Feb 2003
    Location
    Stuttgart, Germany
    Posts
    13,613
    They should work absolutely fine with it. The object IDs are saved as a hexadecimal number, and those are represented as digits from 0 to 9 and a to f.

    http://en.wikipedia.org/wiki/Hexadecimal

    Cheers,
    Mike

  6. #6
    Registered User
    Join Date
    Feb 2003
    Location
    Cumbria UK
    Posts
    419
    Thanks for the replies guys,

    Here's a screen grab of what I have set up. As you can see, the cloned items that have a letter as part of their ID are just shaded in the lowest value in the gradient.

    Maybe I'm doing something wrong..?

    I'll take a look at TrueArt's node library. Thanks for the link sensei.

    Derek
    Attached Thumbnails Attached Thumbnails Click image for larger version. 

Name:	ItemID.jpg 
Views:	77 
Size:	120.1 KB 
ID:	82070  

  7. #7
    TrueArt Support
    Join Date
    Feb 2003
    Location
    Poland
    Posts
    7,900
    ItemID is integer, but Gradient takes floating point as input. So your 0x1000000 is in dec 268435456. Subtract it from ItemID and it'll give you value 0.

  8. #8
    obfuscated SDK hacker Lightwolf's Avatar
    Join Date
    Feb 2003
    Location
    Stuttgart, Germany
    Posts
    13,613
    Quote Originally Posted by Sensei View Post
    ItemID is integer, but Gradient takes floating point as input. So your 0x1000000 is in dec 268435456. Subtract it from ItemID and it'll give you value 0.
    Either that or try the Extended Spot Info which is a part of the free db&w Tools, it provides you with a slightly different set out item ID based outputs.

    Cheers,
    Mike

  9. #9
    Registered User
    Join Date
    Feb 2003
    Location
    Cumbria UK
    Posts
    419
    Cheers Mike, that Extended Spot Info did the trick - exactly what I was expecting first time around!

    But just for my own curiosity sensei, can you explain again what I subtract from what for the other node? From what you wrote I think I should be subtracting 268435456 from the ItemID, then plugging the result into the gradient input...? I tried that, but didn't get any colour variation in the objects...

    Thanks,

    Derek

  10. #10
    obfuscated SDK hacker Lightwolf's Avatar
    Join Date
    Feb 2003
    Location
    Stuttgart, Germany
    Posts
    13,613
    Quote Originally Posted by kyuzo View Post
    Cheers Mike, that Extended Spot Info did the trick - exactly what I was expecting first time around!
    Great.
    Quote Originally Posted by kyuzo View Post
    But just for my own curiosity sensei, can you explain again what I subtract from what for the other node? From what you wrote I think I should be subtracting 268435456 from the ItemID, then plugging the result into the gradient input...? I tried that, but didn't get any colour variation in the objects...
    10000000 is the id of the first object. That's hex, in decimal it's 268435456.
    Basically, the object ID is a 32-bit value, and the higher bits define what kind of item it is: object, bone, camera or light.
    If you look at the same value in binary it's:
    0001 0000 0000 0000 0000 0000 0000 0000 (there you go, 32bits all lined up).
    As you can see, the upper 4 bits are used to designate the item type.

    The Extended Spot Info just removes those bits (and fiddles some more for the other outputs).

    Cheers,
    Mike

  11. #11
    TrueArt Support
    Join Date
    Feb 2003
    Location
    Poland
    Posts
    7,900
    I can only speak about my own TrueArt's Node Library Extended Item Info and Extended Spot Info, because I don't have neither d&b tools nor Dpont nodes. So, if you have ItemID in its natural form like it's in LightWave and LWS text file like 0x10000000, then you have to take it and subtract from it 0x10000000 (dec 268435456) to receive 0. Then it's connected to Gradient Input, with some colors assigned to 0.0, 1.0, 2.0 etc. and connect output to f.e. Diffuse Shading.
    I have just tried it, and worked no problem. ItemID with 0x10000000 gave me red, 0x10000001 yellow, 0x10000002 green. As expected.
    But universal form ItemID, is not human friendly as you noticed- that's why TrueArt's Node Library Extended Item Info has Clone Index output, which is extracting number of duplicated item (the same which you see clicking in Layout viewport item).

    Why there is 0x10000000? Because it means that item is mesh object. Lights have 0x20000000, bones 0x40000000 and cameras 0x30000000.
    My nodes work with all of them. That's why ItemID is untouched.

    If you can't use Clone Index, instead of remembering 268435456, you can just write 2^28 in Subtract, or in Gradient directly.

  12. #12
    Registered User
    Join Date
    Feb 2003
    Location
    Cumbria UK
    Posts
    419
    Much appreciate the explanations guys... I now know far more about hexadecimal numbers than I did before! (which I appreciate, compared to you two is still probably sod all..)

    Sensei, I managed to get your nodes doing what I wanted too, I hadn't realised that I needed to plug your spot info 'item' node in... that was the missing link, and why I wasn't getting any colour variation.

    Thanks again!


    Derek

  13. #13
    Registered User
    Join Date
    Feb 2003
    Location
    Cumbria UK
    Posts
    419
    Oops.. update... I just realised that I shaould have been using sensei's Extended SPOT Info node. Doh. I was using the Extended ITEM info.

    That didn't help...

  14. #14
    obfuscated SDK hacker Lightwolf's Avatar
    Join Date
    Feb 2003
    Location
    Stuttgart, Germany
    Posts
    13,613
    Quote Originally Posted by kyuzo View Post
    Much appreciate the explanations guys... I now know far more about hexadecimal numbers than I did before! (which I appreciate, compared to you two is still probably sod all..)
    We didn't mention nibbles yet, did we ?
    (A nibble is, obviously, half a byte. Which makes it 4 bits assuming the current standard 8 bits per byte. And yes, every digit in the binary number shown below is a bit).

    Cheers,
    Mike

  15. #15
    TrueArt Support
    Join Date
    Feb 2003
    Location
    Poland
    Posts
    7,900
    Quote Originally Posted by kyuzo View Post
    Sensei, I managed to get your nodes doing what I wanted too, I hadn't realised that I needed to plug your spot info 'item' node in... that was the missing link, and why I wasn't getting any colour variation.
    Extended Item Info is working with what is picked up in pop-up control in GUI- double click node to show window with options. Otherwise it's working with what is put in input ItemID. Which can be other Extended Item Info, Extended Spot Info or anything which has LWItemID output.

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •