trouble with objects

Discuss or share your track-related work here

Moderator: kilo

trouble with objects

Postby simon-2 » Fri Mar 06, 2015 10:10 pm

Hi all,
i have some trouble with object generation...

i made a bridge object in my favourite CAD software, exported it as stl, imported to blender, texturized it and exported as ac.

unfortunately, the exported file did not contain the texture filename (but i think, UV-mapping is inside the file..?), so i tried to add it as in other track object files.

then i added this to my track-xml objects section:

Code: Select all
<section name="nbr-bridge-arem">
    <attstr name="object" val="nbr-bridge-arem.ac"/>
    <attnum name="color" val="0x0100FF"/>
    <attstr name="orientation type" val="standard"/>
    <attnum name="orientation" val="70" unit="deg"/>
  </section>


but if i add dots to my object map, i won't get the bridge into my track...

trackgen does not complain and the object map works fine for trees, but no chance to get the bridge into place (nor even into the track).

does anyone know what is wrong with my ac file?

attachment contains:
nbr-bridge.ac, which was exported by blender,
nbr-bridge-arem.ac, with added texture filename
and the texture file .rgb
You do not have the required permissions to view the files attached to this post.
simon-2
 
Posts: 83
Joined: Thu Jan 29, 2015 3:01 pm

Re: trouble with objects

Postby simon-2 » Mon Mar 09, 2015 3:14 am

i managed to get it into the track, but i don't know why :?
after having tried several things, i changed the key-colour to ff00ff (why does pink work and blue does not!? not very logical), after then was the first time i saw the bridge at all, but it had a tree texture :roll: so i had a look for this object in the track.ac file, edited tree1.rgb to the bridge texture filename and voila. i tried it as rgb and png, but everytime i run trackgen, it picks this tree-texture (even after i kicked all trees from my object map, so that there should not be any tree textures at all).
having this in mind, i recognized that all the other trees also use tree1-texture instead of their own (tree2 etc), i always wondered, why they look so similar :lol: ... so what is wrong with trackgen, so that it always uses tree1.rgb for each and every object!?
simon-2
 
Posts: 83
Joined: Thu Jan 29, 2015 3:01 pm

Re: trouble with objects

Postby MiniJoe » Fri Mar 13, 2015 11:55 pm

The code for loading the PNG files does not load the true colors. If you are editing your object-map.png with GIMP, be sure to save the gamma (it is NOT the default) when you export the png. Then the colors will load correctly.
I had no luck with the texture problem. It seems to combine vertices? And only use one texture for the whole object.
I added a grandstand which has concrete sides and people in the front (stadium1.ac), but sd2-trackgen used people1.rgb on all surfaces.
MiniJoe
 
Posts: 95
Joined: Fri Mar 16, 2012 1:32 am

Re: trouble with objects

Postby simon-2 » Sun Mar 15, 2015 3:47 am

thanks Joe,

your explanation with the png loader sounds plausible. i saved object map with gamma now, and additionally used zero compression (resulting in a 6mb file :lol:). But still, it does not work perfectly fine:
i have 2 bridges, both with almost the same file, just another texture and another positioning ("orientation" in objects section in track-xml and "loc"-statement in ac file). When i tried first, i used two pink-tones, ff00ff and ff00fd, but only ff00ff worked. So i tried yellow (ffff00) for the second bridge, and it worked fine :?
is there any rule-of-thumb on what colors (i.e. what type of colors) will be loaded correctly (thus work) and which will not? i think it is quite unhandy to check for every color in SD, if it really generates this particular object, or if i'll have to try another color...
simon-2
 
Posts: 83
Joined: Thu Jan 29, 2015 3:01 pm

Re: trouble with objects

Postby MiniJoe » Sun Mar 15, 2015 4:44 am

I don't know what colors might/might not work. I tried with 0x2f11e7 which is a blue.
speed-dreams\src\libs\tgfclient\guitexture.cpp Line 238:
Code: Select all
   if (png_get_gAMA(png_ptr, info_ptr, &gamma)) {
      png_set_gamma(png_ptr, screen_gamma, gamma);
   } else {
      png_set_gamma(png_ptr, screen_gamma, 0.50);
   }

If I allow png_set_gamma() to set to 0.50 then the color is converted to 0x003716e9 (also a blue).
Try commenting out the the whole block shown above and see if your 'bad' colors work. This worked for me.
The call to png_get_gamma() sets gamma to 0.45455 when I saved with GIMP with 'save gamma' ticked. It works (ie no color conversion). I have no idea where GIMP gets that number. (Video card???)
I commented out the whole block and no conversion occured.
I looked at another Open source PNG loader and it does not call these gamma functions at all.
MiniJoe
 
Posts: 95
Joined: Fri Mar 16, 2012 1:32 am

Re: trouble with objects

Postby MiniJoe » Sun Mar 15, 2015 3:59 pm

MiniJoe
 
Posts: 95
Joined: Fri Mar 16, 2012 1:32 am

Re: trouble with objects

Postby simon-2 » Tue Mar 17, 2015 9:50 pm

thank you so much :) first, i was scared about compiling it myself (and indeed, it took my hole evening until i got it run), but now it seems i can use any color and it picks the correct object.

the other problem still exists (all objects textured with tree1.rgb), but i think i can cope with it (search&replace, depending on numvert, for every object), as long as number of different objects is manageable (though i wonder why it does not work correctly)
simon-2
 
Posts: 83
Joined: Thu Jan 29, 2015 3:01 pm

Re: trouble with objects

Postby simon-2 » Fri Mar 20, 2015 2:46 pm

next problem- is not really object-related, but i did not want to start more and more threads- so i will post remaining track generation problems here.

with pits left, i get this one:

pits_left.png


but with pits right, i get this:

pits_right.png


doors are correct, but pit building is still on the left side :roll:
any ideas?

edit:
i tested it with two other tracks (a simple test oval and a copy of allondaz), and both times, track building was created on left side, although defined on right side. So it is obviously a bug in trackgen..?
You do not have the required permissions to view the files attached to this post.
simon-2
 
Posts: 83
Joined: Thu Jan 29, 2015 3:01 pm

Re: trouble with objects

Postby simon-2 » Sat Mar 21, 2015 4:37 pm

found this:

https://sourceforge.net/p/speed-dreams/tickets/836/

seems to be an older issue, but not fixed yet :(

if blender i/o would work properly, i could move it to the other side...
simon-2
 
Posts: 83
Joined: Thu Jan 29, 2015 3:01 pm

Re: trouble with objects

Postby MiniJoe » Sat Mar 21, 2015 8:49 pm

simon-2 wrote:found this:

https://sourceforge.net/p/speed-dreams/tickets/836/

seems to be an older issue, but not fixed yet :(

if blender i/o would work properly, i could move it to the other side...

Please add any info you think might be helpful to that ticket (836).
Also, feel free to create new tickets for anything else you find wrong with sd2-trackgen (or SD in general).
I plan to fix many items in sd2-trackgen in the future.
I notice that some textures don't appear on the pits in your screenshots. (that is already fixed) :)
MiniJoe
 
Posts: 95
Joined: Fri Mar 16, 2012 1:32 am

Next

Return to SD Tracks

Who is online

Users browsing this forum: No registered users and 3 guests

cron