Animating textures/exporting from Blender

Tips and discussion about scenery creation for RailWorks.

Animating textures/exporting from Blender

Unread postby dogrokket » Sat Mar 01, 2014 12:44 pm

Has anyone successfully exported an animated texture from blender? I've been trying to translate this 3ds tutorialhttp://railsimilarity.blogspot.com/2009/01/how-toanimate-textures.html to blender, but I've hit the wall. I have a neon sign that uses 10 image files in sequence. I've set it up as an 'image sequence' (see below), unwrapped the plane mesh obj to the first image texture. It works well in blender...
scre.jpg

I've named the texture files like this: xxx_00001.ace, xxx_00002.ace......--->xxx_00010.ace and placed them in my scenery texture folder. I exported the .igs file as well as all the texture files. The Rail Similarity tut says that the game should find these and play them in sequence. Mine ain't workin'. I get the plane with the first black texture only.
scre1.jpg

Any ideas guys?
You do not have the required permissions to view the files attached to this post.
Down another rabbit hole we go....
User avatar
dogrokket
 
Posts: 176
Joined: Wed May 08, 2013 2:18 pm

Re: Animating textures/exporting from Blender

Unread postby dogrokket » Tue Mar 04, 2014 10:18 am

I also have 3dcrafter pro. Does anyone know how to animate/export textures with this?? !**conf**!
Down another rabbit hole we go....
User avatar
dogrokket
 
Posts: 176
Joined: Wed May 08, 2013 2:18 pm

Re: Animating textures/exporting from Blender

Unread postby PapaXpress » Tue Mar 04, 2014 11:29 am

What is it you are trying to do?
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: Animating textures/exporting from Blender

Unread postby dogrokket » Tue Mar 04, 2014 8:10 pm

PapaXpress wrote:What is it you are trying to do?

Animate a neon sign, Papa. I got the images to cycle through in blender,(ten image sequence, and it looks great)but I haven't figured out how to get the exporter or the blueprint to reference the other images. If I could figure out how to turn a texture on and off, like a strobe or a ditch light, I think I might be able to figure it out. Thanks!
Down another rabbit hole we go....
User avatar
dogrokket
 
Posts: 176
Joined: Wed May 08, 2013 2:18 pm

Re: Animating textures/exporting from Blender

Unread postby dogrokket » Tue Mar 04, 2014 8:55 pm

Sorry about poor screen capture quality!

Down another rabbit hole we go....
User avatar
dogrokket
 
Posts: 176
Joined: Wed May 08, 2013 2:18 pm

Re: Animating textures/exporting from Blender

Unread postby PapaXpress » Tue Mar 04, 2014 10:54 pm

I have an idea about how to do this 3DC, but I am not sure if it would work.

The other way would be to make each visual element their own group and then turn them on/off in the LUA.

The first you would use an animated scenery blueprint, the second would be a scriptable scenery blueprint.
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: Animating textures/exporting from Blender

Unread postby dogrokket » Wed Mar 05, 2014 11:56 am

PapaXpress wrote:I have an idea about how to do this 3DC, but I am not sure if it would work.

The other way would be to make each visual element their own group and then turn them on/off in the LUA.

The first you would use an animated scenery blueprint, the second would be a scriptable scenery blueprint.


I took a look at your tut on animating ditch lights and it seems like the first example you give here applies there. I don't know a thing about LUA scripting, but I'm interested to learn. Is there a tutorial on that that you know of?

*!!thnx!!*
Down another rabbit hole we go....
User avatar
dogrokket
 
Posts: 176
Joined: Wed May 08, 2013 2:18 pm

Re: Animating textures/exporting from Blender

Unread postby PapaXpress » Wed Mar 05, 2014 12:18 pm

I wouldn't recommend using that example for ditch lights, there are better ways to do it; however, it is an example of how to animate an object.

Right now I don't have the bandwidth to write up a full tutorial.
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: Animating textures/exporting from Blender

Unread postby dogrokket » Wed Mar 05, 2014 4:54 pm

Dom107, the creator of the Blender_2.6x_TS2013_exporter_v1.4.5 got back to me on UKTrainsim forum
by DOM107 on Wed Mar 05, 2014 8:02 pm
Hello,

I see in the tutorial a specific part which is not processed by the exporter:
"Still in the material editor, scroll down to find the "UV Special Effects" area, and tick the "texture is animated" button. Also insert the correct number of frames for your animation in the area marked '#frames' (in our example this would be 4). Also choose a frame rate in the 'frames per second'. In our example we'll choose 2."

To upgrade the exporter, could you contact someone working with 3DSMax so that he creates a simple face with your animated texture and export it.
Then I would look at the created igs file.


If anyone who has 3DS Max would be willing to do this for me, that would be GREATLY appreciated! PM me or respond here. I will send you the the images. You would need to apply the first one to a plane as a material and follow this simple tutorial: http://railsimilarity.blogspot.com/2009/01/how-toanimate-textures.html. This will help DOM update the exporter (if he chooses to). **!!bow!!**
Down another rabbit hole we go....
User avatar
dogrokket
 
Posts: 176
Joined: Wed May 08, 2013 2:18 pm

Re: Animating textures/exporting from Blender

Unread postby dogrokket » Wed Mar 05, 2014 9:52 pm

PapaX, I've come up with with a pre LUA script. Goes like this: (I have a long way to go, and I don't know what the hell I'm doing here yet)

FIRST_TEXTURE(texture name?)_ON _SECS = 2.0
FIRST_TEXTURE_OFF_SECS = 2.0
gTimeSinceLastFlash = 0
gLightFlashOn = false
gFirstLightFlash = true

SECOND_TEXTURE_ON_SECS = 2.0
SECOND_TEXTURE_OFF_SECS = 2.0
gTimeSinceLastFlash = 0
gLightFlashOn = false
gFirstLightFlash = true

ETC_ETC_ETC. !*don-know!*

I figure since I have ten textures in sequence, I could create 10 co-located objects, each with it's own texture and turn them on and off, one by one with a LUA script (which I'm just beginning to learn about. But what the heck, you have to start somewhere, unless you want to pay the man 4Gs for 3DS max! That would be fun, but the wife would kill me.) Am I on to something?
Down another rabbit hole we go....
User avatar
dogrokket
 
Posts: 176
Joined: Wed May 08, 2013 2:18 pm

Re: Animating textures/exporting from Blender

Unread postby PapaXpress » Wed Mar 05, 2014 11:18 pm

Yes you are on to something.

Try this.

WARNING THIS HAS NOT BEEN TESTED! IF YOUR COMPUTER BLOWS UP ITS NOT MY FAULT

Code: Select all
-- set globals

-- assumes the first frame is named Frame_0
gNextFrame = 0;

-- the maximum number of frames, remember we are 0 based
--   so if there are ten frames then the last frame
--   would be Frame_9
MAX_FRAMES = 10;

-- number of seconds to wait till showing the next frame
INTERVAL_SEC = 10


-- initialize, always needed
function Initialise()
   SetFrame( 0 );
end

-- update, always needed
function Update( time )
   SetFrame( time );
end

-- this is where all the heavy lifting is done
function SetFrame( currTime )
   -- loop through each frame every ten seconds
   --   if the current time is 0 then we are initializing the model
   if (math.mod(math.floor(currTime), INTERVAL_SEC) == 0 or currTime == 0) then
      local index = 0;
      while (index < MAX_FRAMES) do
         -- if the frame is equal to the index then turn it on
         if (index == gNextFrame) then
            Call( "*:ActivateNode", "Frame_" .. index,  1 );
         else -- turn the frame off
            Call( "*:ActivateNode", "Frame_" .. index,  0 );
         end   
         index = index + 1;
      end

      -- if we cycled through all the frames then reset to the first frame   
      if (gNextFrame < MAX_FRAMES) then
         gNextFrame = gNextFrame + 1;
      else
         gNextFrame = 0;
      end
   end
end
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: Animating textures/exporting from Blender

Unread postby dogrokket » Thu Mar 06, 2014 10:27 am

Computer blows up... Ha! Thanks for the code!!! I have a few questions before I dive in: When the code references Frame_, is this the assumed name of one of the texture files, or is this a generic code term? For instance, my texture and ace files are named anim_00001, anim_00002 etc.

Second question: what type of blueprint should I create for this? I tried animated scenery blueprint, but I don't recall seeing a place to associate a script to it. Then again, since I've never tried to use a script before, I'm not sure where to put it (although I'm reading signal scripting tutorials) **!!bang!!**

Third question: since the texture frames are the only things being changed here, must there be an associated IA file with the object, or is an IGS file all that's necessary? In other words, the way I understand this process, is that the script is all happening outside of the object itself...?

---EOQs (end of questions).

Thanks for taking the time, I appreciate your help! I think we'll get this figured out!
Down another rabbit hole we go....
User avatar
dogrokket
 
Posts: 176
Joined: Wed May 08, 2013 2:18 pm

Re: Animating textures/exporting from Blender

Unread postby PapaXpress » Thu Mar 06, 2014 3:42 pm

Its not the texture which is getting turned on and off in the LUA, its the node on the GEO (IGS) file.

You will need to use a scripted scenary blueprint. No IA file are needed.
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: Animating textures/exporting from Blender

Unread postby dogrokket » Thu Mar 06, 2014 9:16 pm

Scriptable Scenery Blueprint. Thanks for that! Activating nodes in the IGS... I have to dig around to learn some more on that. I know about nite and day nodes, but I don't think that's what you're talking about. The way I had my blender scene set up was a single pane mesh object with the ten separate textures, that I got blender to play in sequence on the mesh by selecting 'image sequence' under the image drop-down in the texture pane. Would you suggest duplicating this mesh object 10 times, applying the textures to each individually and 'activating' each one of these mesh objects with the script, like the game engine activates fx_day and fx_night textures? Just thinking out loud. BTW, how's that ATL north project coming???

In case anyone is following this thread and doesn't know much about scripting, I found something helpful on railworks wiki re: creating a lua file.

Open Notepad again and type the following:


function OnControlValueChange ( name, index, value )
if Call( "*:ControlExists", name, index ) then
Call( "*:SetControlValue", name, index, value );
end
end

Save this file in the Engine folder as a .txt file

\Source\RSadam\HowTo\RailVehicles\Diesel\SimpleEngine\Engine

In the Engine folder, rename this file SimpleEngine_Script?.lua
Return to the Engine Blueprint.
In the folder tree window, minimise the Engine folder and then expand it again. The LUA file now appears in the folder.


Next, update the information in the Engine Blueprint:

Minimise Browse Information
Minimise RailVehicle? Component
Minimise Render component
Minimise Engine Simulation Container
Minimise Control Container Component
Minimise Container Component
Right click the SimpleEngine_Script?.lua file and select Copy Filename
Paste this into the Script Component Name field in the Engine Blueprint
Minimise Script Component


This is a reference for a locomotive script, but I think it applies to all scripts. Found here: http://railworkswiki.com/tiki-index.php?page=Creating%20the%20Script%20Component&structure=Reference%20Manual
Down another rabbit hole we go....
User avatar
dogrokket
 
Posts: 176
Joined: Wed May 08, 2013 2:18 pm

Re: Animating textures/exporting from Blender

Unread postby PapaXpress » Thu Mar 06, 2014 10:02 pm

Dog, don't muddy the waters bu throwing in engine scripts. Scenary objects don't have controls.
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

Next

Return to Scenery Design

Who is online

Users browsing this forum: No registered users and 0 guests