Portable autonumbering - with example!

Discussion of rolling-stock creation & re-painting.

Portable autonumbering - with example!

Unread postby Kali » Tue Nov 08, 2011 12:53 am

Well, I was going to finish the CN boxcar I was doing and then pop it in the library at the same time as doing this, but I don't have time right now and I did promise I'd show something months ago :) so you get a half-finished CN version of Michael's freeware 40ft boxcar instead - pretty much literally dragged the layers off my other one and saved it. You can probably stick it in scenarios if you want as I'll finish it ( and the 50ft one ) one day soon hopefully, but I'd avoid posting any public scenarios that use it for now please.

Anyway, I've put a bundle of scripts together ( in one sitting, so I don't know if they'll stay quite the same way as they are! ). The autonumber widget itself is exactly like putting numbers actually into a body model, just extracted into a child object - the only difference I can see is that the TrainDecal shader won't alpha blend for child objects, it just does alpha transparency like the older shaders. You can set the contents of child objects like that just the same as setting the number plates on signals. If you're interested in the rest of it ( how it actually works for one thing ), the functionality is mostly in Assets/K-Rail/Scripts/Generic/Lib/PAN.lua - which is a bit rough & ready but at least is functional.

If you're a painter & don't care about the rest, all you need as far as scripts go is in the script to the boxcar. You just have to set up the names of your child objects, and then obviously add the child objects to the blueprint. Doing number textures is exactly like doing them for normal autonumbers. If someone wants to do a range of better widgets, please please do :P I didn't really pay much attention to material settings.

And now a slightly clever bit: if you still want the default stock's autonumbers to work but you want to use this system to set up per-car logos, or weathering children, or anything texture sets can do and you want a set of numbers with extra digits, you can add the car itself ( or you should be able to, I must admit I've not really tried it given I have nothing to test atm ) like this:

Code: Select all
   PAN_NewAutonumberArray( { "" }, 0, 5 )


and it should use the first 5 digits. The last two digits are the parameters to lua's string.sub() if you want to look it up. If there's any point I could do more complicated things by passing functions instead of substring indexes, but let's wait & see if someone needs it.

Anyway please give me some time to do my CN cars, there's plenty else you can do ;) click the boxcar image to grab the example. You will need Michael's 40ft PS-1 freeware boxcar first ( if you want to use it, at least ), and it lives in Greatnortherner/Alleghany as KR CN 40ft PS1 Boxcar

Image

Any questions, fire away. If for some strange reason you want to use the current scripts, talk to me first, I can probably provide a better alternative at the moment... too many things liable to change.

Edit: to save a bit of confusion, links to examples below:

* Example boxcar - there's no autonumbers set up, the format is two letters and 5 or 6 numbers, the letters will determine which door and roof type you get.
* Latest WIP script package - 12/11/2011 10:00 - you will need this also.

And a little more complicated example, but this one has a second texture set, a bit of translation to reach different parts of the texture set & resizing the number panel in the child matrix in the wagon blueprint:

Image

* Example caboose

And you need the script package too.
Last edited by Kali on Sun Nov 13, 2011 8:35 am, edited 6 times in total.
Kali
 
Posts: 1600
Joined: Mon Mar 14, 2011 1:00 am
Location: England-by-Sea

Re: Portable autonumbering - with example!

Unread postby imnew » Tue Nov 08, 2011 5:11 am

No questions, just a thanks for doing this !!*ok*!! Will check this out in more detail after i get back home.
Intel Core I7-7770K, ZOTAC GTX 1080 Ti AMP
Extreme, ASUS ROG Strix Z270H, 16 GB HyperX Fury DDR4, Samsung 850 EVO 500GB, Corsair Force MP500 240GB M.2, 34" Ultra Wide Samsung Monitor
User avatar
imnew
 
Posts: 2456
Joined: Tue Aug 25, 2009 1:41 pm

Re: Portable autonumbering - with example!

Unread postby PapaXpress » Tue Nov 08, 2011 12:12 pm

I am soooooo looking forward to this. I will be able to fix my SP and SSW flatbed repaints!
Image
"Just post some random unrelated text. We have members here who can help you with that." ~ Chacal
"When all else fails, read the instructions... if that doesn't work either, try following them." ~ Old Prof
Image
The Grade Crossing - Atlanta North Project - Virtual Rail Creations
User avatar
PapaXpress
 
Posts: 5147
Joined: Sat Oct 23, 2010 10:30 pm
Location: that "other" timezone

Re: Portable autonumbering - with example!

Unread postby Kali » Tue Nov 08, 2011 4:26 pm

You can do whatever you want :) I posted an example so you can start fiddling around already - if you want to repurpose the bits from the boxcar go ahead, although I will knock you up a script at the moment if you want to release anything, there's too much risk of version conflicts to use what's in the example, it was provided for people who're interested in the hows of what's going on.

You can scale child objects using the location matrix in the wagon blueprint; look up matrix transformations, if you lay the 12 rows of numbers from the child object matrix into four columns of four you'll have the location matrix, you can multiply the top-left corner with a 3x3 matrix to translate/rotate/scale it ( and I think you can just change the bottom-right number to uniformly scale it too, although don't quote me on that ). So you can rescale the numbers somewhat without knocking up a new geo file.
Kali
 
Posts: 1600
Joined: Mon Mar 14, 2011 1:00 am
Location: England-by-Sea

Re: Portable autonumbering - with example!

Unread postby Kali » Fri Nov 11, 2011 5:50 am

I've managed to hook the furniture ( doors/walkway ) from Michael's car into the autonumbering too, so you can generate a variety from the dcsvs and of course set them yourself rather than cluttering everything up with 6 versions of each livery. Not too sure of any performance cost yet, but doors aren't really complicated.

All except the plug door anyway, which just stubbornly sits there... and a bit of hassle with part of the walkway, but I might be able to sort that out.

Image

Not all the walkway is disappearing, bit of a pity.
Kali
 
Posts: 1600
Joined: Mon Mar 14, 2011 1:00 am
Location: England-by-Sea

Re: Portable autonumbering - with example!

Unread postby Kali » Tue Nov 15, 2011 9:50 pm

Updated the caboose to fix a bug in the wrapper script - wasn't replacing 0 values because everything in lua starts from 1...
Kali
 
Posts: 1600
Joined: Mon Mar 14, 2011 1:00 am
Location: England-by-Sea

Re: Portable autonumbering - with example!

Unread postby PapaXpress » Tue Nov 15, 2011 11:27 pm

Kali wrote:Updated the caboose to fix a bug in the wrapper script - wasn't replacing 0 values because everything in lua starts from 1...


was scratching my head with that one...
Image
"Just post some random unrelated text. We have members here who can help you with that." ~ Chacal
"When all else fails, read the instructions... if that doesn't work either, try following them." ~ Old Prof
Image
The Grade Crossing - Atlanta North Project - Virtual Rail Creations
User avatar
PapaXpress
 
Posts: 5147
Joined: Sat Oct 23, 2010 10:30 pm
Location: that "other" timezone

Re: Portable autonumbering - with example!

Unread postby PapaXpress » Wed Nov 30, 2011 12:17 pm

Kali, a few question for you. So I made my own decal. I discovered the hard way that I should not use the "decal" blueprint in the asset editor, but after looking at your GEOs I used an animated scenery blueprint. I also tried to use the same filters and settings for my model that I found in your GEO. I was successful, but I want to understand this better.

First I tried to apply my decal/model as a child, but it didn't show up (even removed the texture to try and get the "missing texture" to show), but when I added my child node to your script it appeared. Does this mean that ideally decals should be added to the model during its creation (it seems your library can do this magically)?

Second. My decals are semi-transparent, which is what I need in most cases, however; is there a way to make them show solid? Here is what I am trying to do. On my SP Caboose I had to cover some of the windows. I did this by creating a simple flat "plate" in 3DC and then add it as a child. This is a small poly hit, but I would like to use decal instead which seems to have less of a poly count (perhaps none?). Can this be done?

Thanks
Image
"Just post some random unrelated text. We have members here who can help you with that." ~ Chacal
"When all else fails, read the instructions... if that doesn't work either, try following them." ~ Old Prof
Image
The Grade Crossing - Atlanta North Project - Virtual Rail Creations
User avatar
PapaXpress
 
Posts: 5147
Joined: Sat Oct 23, 2010 10:30 pm
Location: that "other" timezone

Re: Portable autonumbering - with example!

Unread postby Kali » Wed Nov 30, 2011 12:34 pm

PapaXpress wrote:Kali, a few question for you. So I made my own decal. I discovered the hard way that I should not use the "decal" blueprint in the asset editor, but after looking at your GEOs I used an animated scenery blueprint. I also tried to use the same filters and settings for my model that I found in your GEO. I was successful, but I want to understand this better.


Doesn't even need to be an animated scenery blueprint, just a normal one would do. That just happens to be at the top of the list :). I would suspect the Decal blueprint would be for landscape decals. Interesting though, never thought to try that with a shape.

First I tried to apply my decal/model as a child, but it didn't show up (even removed the texture to try and get the "missing texture" to show), but when I added my child node to your script it appeared. Does this mean that ideally decals should be added to the model during its creation (it seems your library can do this magically)?


First I need to know a little about what your child is meant to represent; if you've made a complete nameplate with numbers that show up when you tell my script about it ( well done for that! grasping that whole process is annoying ), then ... what shows up if you don't set a number is the default textures - primarynumber_1.tgpcdx etc. If they're transparent, then obviously your child is going to be transparent too. Put an acceptable number into it and hey presto the digits appear.

I suspect any child object is attached to the main shape at runtime - mine doesn't magically do anything more than just adding it to the blueprint does. Adding number panels ( and logos, and any other high-rez bits ) at creation does mean you get much better use of the TrainDecal shader.

Second. My decals are semi-transparent, which is what I need in most cases, however; is there a way to make them show solid? Here is what I am trying to do. On my SP Caboose I had to cover some of the windows. I did this by creating a simple flat "plate" in 3DC and then add it as a child. This is a small poly hit, but I would like to use decal instead which seems to have less of a poly count (perhaps none?). Can this be done?

Thanks


Nope, I haven't done anything different to you - mine are just named specially. What you did was add one whole poly to a model; your PC is going to laugh at you for worrying about that :) what the TrainDecal shader does is magically paint the contents of my polys onto the surface underneath them, there's still extra polys.

When you start adding multiples of 3000 poly handrails visible out to 2km, then we'll start talking about unnecessary poly hits :)
Kali
 
Posts: 1600
Joined: Mon Mar 14, 2011 1:00 am
Location: England-by-Sea

Re: Portable autonumbering - with example!

Unread postby PapaXpress » Wed Nov 30, 2011 12:53 pm

OK, I am feeling better about all this.

Kali wrote:Doesn't even need to be an animated scenery blueprint, just a normal one would do. That just happens to be at the top of the list :). I would suspect the Decal blueprint would be for landscape decals. Interesting though, never thought to try that with a shape.


Just to reiterate, the decal object did not seem to work when applied to the model. I didn't think to try it on the terrain (dynamic terrain???).

Kali wrote:First I need to know a little about what your child is meant to represent; if you've made a complete nameplate with numbers that show up when you tell my script about it ( well done for that! grasping that whole process is annoying ), then ... what shows up if you don't set a number is the default textures - primarynumber_1.tgpcdx etc. If they're transparent, then obviously your child is going to be transparent too. Put an acceptable number into it and hey presto the digits appear.

I suspect any child object is attached to the main shape at runtime - mine doesn't magically do anything more than just adding it to the blueprint does. Adding number panels ( and logos, and any other high-rez bits ) at creation does mean you get much better use of the TrainDecal shader.


What I did so far is akin to adding a logo. The trick is that it would not appear on the model until I used your script. I still need to figure out the curved autonumbers for the tank car (I may release the repaint without it and then do a v2 when I figure it out).

Kali wrote:Nope, I haven't done anything different to you - mine are just named specially. What you did was add one whole poly to a model; your PC is going to laugh at you for worrying about that :) what the TrainDecal shader does is magically paint the contents of my polys onto the surface underneath them, there's still extra polys.

When you start adding multiples of 3000 poly handrails visible out to 2km, then we'll start talking about unnecessary poly hits :)


Thanks again. Between you, Jerry, MadMike, and GreatNortherner my refits are really coming alive.
Image
"Just post some random unrelated text. We have members here who can help you with that." ~ Chacal
"When all else fails, read the instructions... if that doesn't work either, try following them." ~ Old Prof
Image
The Grade Crossing - Atlanta North Project - Virtual Rail Creations
User avatar
PapaXpress
 
Posts: 5147
Joined: Sat Oct 23, 2010 10:30 pm
Location: that "other" timezone

Re: Portable autonumbering - with example!

Unread postby Kali » Wed Nov 30, 2011 2:44 pm

PapaXpress wrote:
Just to reiterate, the decal object did not seem to work when applied to the model. I didn't think to try it on the terrain (dynamic terrain???).


Um. Maybe... if you added a decal as a child of a signal. Someone needs to try using a texture set on a decal now if that's even possible... I have no idea what a decal is made of, I'm terrible at routes. Signals are the only scenery I can think of that have scripts.

What on earth you'd use it for I really don't have a clue! going to have an animated farmer ploughing? I guess actually it might be fun if you could hook it into the weather & make things wetter. The performance hit would probably be atrocious though.

What I did so far is akin to adding a logo. The trick is that it would not appear on the model until I used your script. I still need to figure out the curved autonumbers for the tank car (I may release the repaint without it and then do a v2 when I figure it out).


Er, that shouldn't be necessary. Let me see the geo?

For the tank car, chop some existing polys horizontally twice and bend the top & bottom edges back a bit.

Thanks again. Between you, Jerry, MadMike, and GreatNortherner my refits are really coming alive.


The more people doing fun things the merrier :)
Kali
 
Posts: 1600
Joined: Mon Mar 14, 2011 1:00 am
Location: England-by-Sea

Re: Portable autonumbering - with example!

Unread postby PapaXpress » Wed Nov 30, 2011 2:51 pm

Kali wrote:Er, that shouldn't be necessary. Let me see the geo?

For the tank car, chop some existing polys horizontally twice and bend the top & bottom edges back a bit.


I'll get my GEO in a bit as its almost lunch time here, but the IGS files you sent me did not work completely. The CN model refused to load, and that is the one I am most interested in altering.

Kali wrote:The more people doing fun things the merrier :)


The down side to all this merriment is that I am spending so much time modeling, and my route is getting no love *!sad!* Thankfully this is all fun stuff! !*YAAA*!

Update: GEO attached
DecalTest.zip
You do not have the required permissions to view the files attached to this post.
Image
"Just post some random unrelated text. We have members here who can help you with that." ~ Chacal
"When all else fails, read the instructions... if that doesn't work either, try following them." ~ Old Prof
Image
The Grade Crossing - Atlanta North Project - Virtual Rail Creations
User avatar
PapaXpress
 
Posts: 5147
Joined: Sat Oct 23, 2010 10:30 pm
Location: that "other" timezone

Re: Portable autonumbering - with example!

Unread postby PapaXpress » Thu Dec 01, 2011 3:15 am

I was wrong! i did not need your script to make the decal show.
Image
"Just post some random unrelated text. We have members here who can help you with that." ~ Chacal
"When all else fails, read the instructions... if that doesn't work either, try following them." ~ Old Prof
Image
The Grade Crossing - Atlanta North Project - Virtual Rail Creations
User avatar
PapaXpress
 
Posts: 5147
Joined: Sat Oct 23, 2010 10:30 pm
Location: that "other" timezone

Re: Portable autonumbering - with example!

Unread postby PapaXpress » Fri Dec 02, 2011 1:40 pm

Kali, you have in your library a way to change out the child doors on the box car. Is it possible to show child objects based on season? Mike and I would like to release our GP38-2 refit with the snow gear enabled only for the winter.
Image
"Just post some random unrelated text. We have members here who can help you with that." ~ Chacal
"When all else fails, read the instructions... if that doesn't work either, try following them." ~ Old Prof
Image
The Grade Crossing - Atlanta North Project - Virtual Rail Creations
User avatar
PapaXpress
 
Posts: 5147
Joined: Sat Oct 23, 2010 10:30 pm
Location: that "other" timezone

Re: Portable autonumbering - with example!

Unread postby Kali » Fri Dec 02, 2011 2:12 pm

Nope, no scenario time/date info at all available. Does it have winter textures? make the ones for the other seasons transparent, is all I can think of.

Well maybe DP does something odd, but there's been no core update to add scripting events - and I don't think what I'm doing with those doors is really officially sanctioned anyway :)
Kali
 
Posts: 1600
Joined: Mon Mar 14, 2011 1:00 am
Location: England-by-Sea

Next

Return to Rolling-Stock Design

Who is online

Users browsing this forum: No registered users and 27 guests

cron