[Discussion] Sketchup, Blender, 3Dmax and other 3D programs
Moderator: Locomotion Moderators

 Traffic Manager
 Posts: 223
 Joined: 09 Dec 2007 22:29
Re: [Discussion] Sketchup, Blender, 3Dmax and other 3D programs
Can you translate that to English?
This my friend, is why I don't use Sketchup.
This my friend, is why I don't use Sketchup.
_______________________________________________________
Member of Chicago Locomotive Works.
Member of Chicago Locomotive Works.
Re: [Discussion] Sketchup, Blender, 3Dmax and other 3D programs
Which program do you use lego? (I'm assuming blender or 3dsm)

 Traffic Manager
 Posts: 223
 Joined: 09 Dec 2007 22:29
Re: [Discussion] Sketchup, Blender, 3Dmax and other 3D programs
I have an older version of Max. I can't afford or really need to upgrade just for Locomotion. Like most of people that make trains in Max, I learned in GMax following tutorials for MSTS trains. Unfortunately, It is almost impossible to get Gmax models into Max. I have a really nice BR V100 in Gmax I can't render.
_______________________________________________________
Member of Chicago Locomotive Works.
Member of Chicago Locomotive Works.

 Chief Executive
 Posts: 675
 Joined: 20 Nov 2005 12:10
 Location: Australia; Melbourne
Re: [Discussion] Sketchup, Blender, 3Dmax and other 3D programs
Is it me; or does it look like silk?
Re: [Discussion] Sketchup, Blender, 3Dmax and other 3D programs
Ok I've been busy for a while but I want to know if there is a way to get the sprites out of blender.
If not I'll keep looking for some cheap software, cause I can't afford something like 3dsm.
If not I'll keep looking for some cheap software, cause I can't afford something like 3dsm.

 Chief Executive
 Posts: 675
 Joined: 20 Nov 2005 12:10
 Location: Australia; Melbourne
Re: [Discussion] Sketchup, Blender, 3Dmax and other 3D programs
What you have to do, is learn about the camera, and rather then create an animation, where the object goes over the 250 frames in a flowing motion, you have to set it so that each frame = 1 sprite, and then all renders go into your (C:/tmp) folder... you can also set what the images come out as... set it to png.
You just reminded me to ask blenderguru about setting a script to do this automatically, and if its possible. (Thanks for reminding me)
You just reminded me to ask blenderguru about setting a script to do this automatically, and if its possible. (Thanks for reminding me)
Re: [Discussion] Sketchup, Blender, 3Dmax and other 3D programs
Okay, I've been able to fiddle with the camera a little bit and got it moving. But lighting continues to be a problem. Is there a way to disable it?

 Chief Executive
 Posts: 675
 Joined: 20 Nov 2005 12:10
 Location: Australia; Melbourne
Re: [Discussion] Sketchup, Blender, 3Dmax and other 3D programs
What you should do, is attach the light(sun, or lamp) to the camera...
Re: [Discussion] Sketchup, Blender, 3Dmax and other 3D programs
Has anybody ever tried making anything in Autodesk Inventor? (same makers as 3Ds max)
I was playing around with it earlier today. And maybe it's just because of my prior experience, but I've started picking it up much quicker than max (not that I've spent much time with either).
I'd like to make some basic Australian rolling stock at some stage when I get the chance (NSWGR/PN...). What I've got here is a quick WIP of a SRA NHFF coal hopper.
Not sure about texturing and stuff(if I can, but I'll be looking into it.) but there's always importing it into max from there...
I was playing around with it earlier today. And maybe it's just because of my prior experience, but I've started picking it up much quicker than max (not that I've spent much time with either).
I'd like to make some basic Australian rolling stock at some stage when I get the chance (NSWGR/PN...). What I've got here is a quick WIP of a SRA NHFF coal hopper.
Not sure about texturing and stuff(if I can, but I'll be looking into it.) but there's always importing it into max from there...
In exile until I have time to live again.
[WIP] (on hold)  QLD Narrow Gauge Set/Sugar Cane Plantation
[WIP/Beta] (on hold)  Sydney Cityrail Platforms
[WIP]NSW Rollingstock
[WIP] (on hold)  QLD Narrow Gauge Set/Sugar Cane Plantation
[WIP/Beta] (on hold)  Sydney Cityrail Platforms
[WIP]NSW Rollingstock
Re: [Discussion] Sketchup, Blender, 3Dmax and other 3D programs
Anybody using 3D Canvas (3DC)?
I downloaded a ton of free 3D modeling software and renderers a couple months ago. Snooped around in some of them, and settlled on 3DC for my first attempt since it had an interface that was intuitive (at least to me).
After working through the builtin tutorial, I thought I'd try an old timey (steam era) U.S. water tower for my first serious project. The pic below is where I'm at with it. The spout pivots too. But now I'm stuck. 3DC doesn't seem to have (or I can't find) any separate dialog boxes for the camera settings, so I can't set the angles properly. The pic is just a guesstimate of the proper angles using a mouse.
If anyone's used this program and can offer some advice I'd be grateful.
Thanks.
I downloaded a ton of free 3D modeling software and renderers a couple months ago. Snooped around in some of them, and settlled on 3DC for my first attempt since it had an interface that was intuitive (at least to me).
After working through the builtin tutorial, I thought I'd try an old timey (steam era) U.S. water tower for my first serious project. The pic below is where I'm at with it. The spout pivots too. But now I'm stuck. 3DC doesn't seem to have (or I can't find) any separate dialog boxes for the camera settings, so I can't set the angles properly. The pic is just a guesstimate of the proper angles using a mouse.
If anyone's used this program and can offer some advice I'd be grateful.
Thanks.
 Attachments

 Goal was for a weathered look.
 WT Snapshot 1.png (121.59 KiB) Viewed 8014 times
Re: [Discussion] Sketchup, Blender, 3Dmax and other 3D progr
Let me post some of the tiny tools written by me for those who may want to use blender to make their objects. It can be used to generate the sprites for virtually all types of objects.
The first one is my tiny rendering script written in python. You can choose to simply copy & paste then run it in Text Window, but you are encouraged to copy the code into a .py file, place it into the script directory of Blender (Should be something like %APPDATA%\Roaming\Blender Foundation\Blender\.blender\scripts) then call it from the "Scripts" menu in Script Window.
The second one is a simple sprite entries generator for the xml config file written in javascript. Just edit the parameters using HTML editor or even notepad, then load it using any web browser you like. It will do one of the most tedious parts in the xml config file in less than a second. Personally I like to modify the xml directly rather than using vehicle creator.
I hope all of you may find them useful.
The first one is my tiny rendering script written in python. You can choose to simply copy & paste then run it in Text Window, but you are encouraged to copy the code into a .py file, place it into the script directory of Blender (Should be something like %APPDATA%\Roaming\Blender Foundation\Blender\.blender\scripts) then call it from the "Scripts" menu in Script Window.
Code: Select all
#!BPY
""" Registration info for Blender menus:
Name: 'Auto renderer for Locomotion'
Blender: 237
Group: 'Render'
Tooltip: 'Generate sprites for Locomotion Objects'
"""
__author__ = "K.Y.Chung"
__url__ = ("blender", "kychung")
__version__ = "3.0"
__bpydoc__ = """\
This script can generate the sprites for Locomotion Objects. All Rights Reserved. The author disclaims all liabilities.
"""
from Blender import *
from Blender.BGL import *
from Blender.Draw import *
from Blender.Scene import Render
import math
# Events
EVENT_MENU_V = 1
EVENT_MENU_O = 4
EVENT_START = 2
EVENT_EXIT = 3
# Vehicle Type
vehType = Create(1)
# Object to rotate/orbit
targetObject = Create(1)
# Sprites for Railway Car Bogies
b1 = range ( 0, 16 ) # Sprite indexes for horizontal
b2 = range ( 16, 48 ) # Sprite indexes for 11.5 degree slopes
# Sprites for Railway Cars / Narrow Gauge Railway Cars / Ships / Aircrafts
i1 = range ( 0, 64 ) # Sprite indexes for horizontal
# Additional sprites for Railway Cars / Narrow Gauge Railway Cars / Aircrafts
i2 = range ( 64, 68 ) # Sprite indexes for 6 degree slope
i3 = range ( 68, 72 ) # Sprite indexes for 6 degree slopes
i4 = range ( 72, 104 ) # Sprite indexes for 11.5 degree slopes
i5 = range ( 104, 136 ) # Sprite indexes for 11.5 degree slopes
# Additional sprites for Narrow Gauge Railway Cars
i6 = range ( 136, 140 ) # Sprite indexes for 17 degree slopes
i7 = range ( 140, 144 ) # Sprite indexes for 17 degree slopes
i8 = range ( 144, 176 ) # Sprite indexes for 22.5 degree slopes
i9 = range ( 176, 208 ) # Sprite indexes for 22.5 degree slopes
# Sprites for Road Vehicles / Trams / Aircraft Shadows
j1 = range ( 0, 32 ) # Sprite indexes for horizontal
j2 = range ( 32, 36 ) # Sprite indexes for 6 degree slope
j3 = range ( 36, 40 ) # Sprite indexes for 6 degree slopes
j4 = range ( 40, 44 ) # Sprite indexes for 11.5 degree slopes
j5 = range ( 44, 48 ) # Sprite indexes for 11.5 degree slopes
j6 = range ( 48, 52 ) # Sprite indexes for 17 degree slopes
j7 = range ( 52, 56 ) # Sprite indexes for 17 degree slopes
j8 = range ( 56, 60 ) # Sprite indexes for 22.5 degree slopes
j9 = range ( 60, 64 ) # Sprite indexes for 22.5 degree slopes
# Sprites for Aircraft Shadows
k1 = range ( 136, 168 )
#Sprites for Buildings
k2 = range ( 0, 4 )
# GUI drawing
def draw():
global vehType, targetObject
global EVENT_MENU_V, EVENT_MENU_O, EVENT_START, EVENT_EXIT
glClear(GL_COLOR_BUFFER_BIT)
glColor3f(0,0,0)
# Limitations and Precautions
glRasterPos2d(10, 250)
Text("Limitations and precautions: (READ CAREFULLY BEFORE START)")
glRasterPos2d(10, 225)
Text("1. All the render parameters and lights should be set manually before running this script. The script will do nothing about it.")
glRasterPos2d(10, 210)
Text("2. There should be ONE and NO MORE THAN ONE camera in the scene, which has been configured properly.")
glRasterPos2d(10, 195)
Text("3. The camera should be placed in the 2nd quadrant, pointing towards the origin.")
glRasterPos2d(10, 180)
Text("3. The vehicle itself should be a single mesh object, join all together if there is more than one.")
glRasterPos2d(10, 165)
Text("4. Check the orientation of the vehicle by switching to Front View first. The vehicle should head along yaxis towards ve direction initially.")
glRasterPos2d(10, 150)
Text("4. The vehicle object should not be translated or rotated in \"Transform Properties\". Object scales should be the same in all directions.")
glRasterPos2d(10, 135)
Text("5. You need to \"tilt\" the \"car\" by yourself in Edit Mode if you are making tilt trains.")
# Titles
glRasterPos2d(10,290)
Text("Generate sprites for Locomotion Objects", 'large')
# Menu to choose vehicle type
glColor3f(1,1,1)
glRasterPos2d(10, 90)
Text("Vehicle Type:")
MenuOptions = "Railway Cars %x1Railway Cars (Tilt Trains) %x9Railway Cars (Tilt Trains banking left) %x10Railway Cars (Tilt Trains banking right) %x11Railway Car Bogies %x13Narrow Gauge Railway Cars %x2Road Vehicles %x3Braking Lights of Road Vehicles %x4Trams %x5Ships %x6Aircrafts %x7Aircraft Shadows %x12Buildings %x8"
vehType = Menu(MenuOptions, 1, 150, 85, 220, 20, vehType.val, "Choose the Vehicle Type.")
#Menu to choose the object to rotate/orbit
glRasterPos2d(10, 50)
Text("Object to rotate/orbit:")
MenuTargetObject = "Mesh %x1Camera %x2"
targetObject = Menu(MenuTargetObject, 4, 150, 45, 220, 20, targetObject.val, "Choose the object to rotate/orbit.")
# Start and Exit
Button("Start", 2, 10, 10, 50, 18)
Button("Exit", 3, 70, 10, 50, 18)
def event(evt, val):
global vehType, targetObject
global EVENT_MENU_V, EVENT_MENU_O
if ((evt == QKEY) or (evt == ESCKEY)):
Exit()
elif (evt == EVENT_MENU_V):
vehType == val
elif (evt == EVENT_MENU_O):
targetObject == val
def bevent(evt):
global vehType, targetObject
global EVENT_START, EVENT_EXIT
# Manages GUI events
if (evt == EVENT_EXIT):
Exit()
elif (evt == EVENT_START):
main()
def autoRender(n):
global vehType
# Get the sprite index, shift or multiply for some vehicle types
if (vehType == 3):
n = n * 2
if (vehType == 4):
n = ( n * 2 ) + 1
if (vehType == 9):
n = n * 3
if (vehType == 10):
n = ( n * 3 ) + 1
if (vehType == 11):
n = ( n * 3 ) + 2
k = str(n)
while (len(k) < 3): # Fill leading zeros
k = '0' + k
# Execute rendering routine
scene= Scene.GetCurrent()
context = scene.getRenderingContext()
context.render()
context.saveRenderedImage(k)
def main():
scn = Scene.GetCurrent()
ob = scn.objects.active # Gets the current active object (If Any)
if ob == None or ob.getType() != 'Mesh': # Checks the active objects a mesh
Draw.PupMenu('ERROR%tSelect a mesh object.')
return
c = scn.objects.camera # Gets the active camera
Window.WaitCursor(1) # So the user knowns the script is busy.
is_editmode = Window.EditMode() # Store edit mode state
if is_editmode: Window.EditMode(0) # Python must get a mesh in object mode.
if (targetObject == 1):
main_o(ob)
elif (targetObject == 2):
main_c(ob, c)
# Go back into editmode if we started in edit mode.
if is_editmode: Window.EditMode(1)
Window.WaitCursor(0)
def main_c(ob, c):
global vehType
global b1, b2, i1, i2, i3, i4, i5, i6, i7, i8, i9, j1, j2, j3, j4, j5, j6, j7, j8, j9, k1, k2
#Get the initial pose of the camera
c_LocXInit = c.LocX
c_LocYInit = c.LocY
c_RotZInit = c.RotZ
c_modulus = math.hypot ( c_LocXInit, c_LocYInit )
if (vehType == 13):
for x in b1:
c.RotZ = c_RotZInit + ( math.pi / 16 * ( x  b1[0] ) )
c.LocX = c_modulus * math.cos ( c.RotZ  ( math.pi / 2 ) )
c.LocY = c_modulus * math.sin ( c.RotZ  ( math.pi / 2 ) )
autoRender(x)
#Reset camera pose
c.LocX = c_LocXInit
c.LocY = c_LocYInit
c.RotZ = c_RotZInit
for x in b2:
ob.RotX =  ( math.pi / 180 * 11.5 )
c.RotZ = c_RotZInit + ( math.pi / 16 * ( x  b2[0] ) )
c.LocX = c_modulus * math.cos ( c.RotZ  ( math.pi / 2 ) )
c.LocY = c_modulus * math.sin ( c.RotZ  ( math.pi / 2 ) )
autoRender(x)
#Reset camera pose
c.LocX = c_LocXInit
c.LocY = c_LocYInit
c.RotZ = c_RotZInit
if ((vehType == 1) or (vehType == 2) or (vehType == 6) or (vehType == 7) or (vehType == 9) or (vehType == 10) or (vehType == 11)):
for x in i1:
c.RotZ = c_RotZInit + ( math.pi / 32 * ( x  i1[0] ) )
c.LocX = c_modulus * math.cos ( c.RotZ  ( math.pi / 2 ) )
c.LocY = c_modulus * math.sin ( c.RotZ  ( math.pi / 2 ) )
autoRender(x)
#Reset camera pose
c.LocX = c_LocXInit
c.LocY = c_LocYInit
c.RotZ = c_RotZInit
if ((vehType == 1) or (vehType == 2) or (vehType == 7) or (vehType == 9) or (vehType == 10) or (vehType == 11)):
for x in i2:
ob.RotX =  ( math.pi / 30 )
c.RotZ = c_RotZInit + ( math.pi / 2 * ( x  i2[0] ) )
c.LocX = c_modulus * math.cos ( c.RotZ  ( math.pi / 2 ) )
c.LocY = c_modulus * math.sin ( c.RotZ  ( math.pi / 2 ) )
autoRender(x)
#Reset camera pose
c.LocX = c_LocXInit
c.LocY = c_LocYInit
c.RotZ = c_RotZInit
for x in i4:
ob.RotX =  ( math.pi / 180 * 11.5 )
c.RotZ = c_RotZInit + ( math.pi / 16 * ( x  i4[0] ) )
c.LocX = c_modulus * math.cos ( c.RotZ  ( math.pi / 2 ) )
c.LocY = c_modulus * math.sin ( c.RotZ  ( math.pi / 2 ) )
autoRender(x)
#Reset camera pose
c.LocX = c_LocXInit
c.LocY = c_LocYInit
c.RotZ = c_RotZInit
if ((vehType == 1) or (vehType == 2) or (vehType == 9) or (vehType == 10) or (vehType == 11)):
for x in i3:
ob.RotX = math.pi / 30
c.RotZ = c_RotZInit + ( math.pi / 2 * ( x  i3[0] ) )
c.LocX = c_modulus * math.cos ( c.RotZ  ( math.pi / 2 ) )
c.LocY = c_modulus * math.sin ( c.RotZ  ( math.pi / 2 ) )
autoRender(x)
#Reset camera pose
c.LocX = c_LocXInit
c.LocY = c_LocYInit
c.RotZ = c_RotZInit
for x in i5:
ob.RotX = math.pi / 180 * 11.5
c.RotZ = c_RotZInit + ( math.pi / 16 * ( x  i5[0] ) )
c.LocX = c_modulus * math.cos ( c.RotZ  ( math.pi / 2 ) )
c.LocY = c_modulus * math.sin ( c.RotZ  ( math.pi / 2 ) )
autoRender(x)
#Reset camera pose
c.LocX = c_LocXInit
c.LocY = c_LocYInit
c.RotZ = c_RotZInit
if (vehType == 2):
for x in i6:
ob.RotX =  ( math.pi / 180 * 17 )
c.RotZ = c_RotZInit + ( math.pi / 2 * ( x  i6[0] ) )
c.LocX = c_modulus * math.cos ( c.RotZ  ( math.pi / 2 ) )
c.LocY = c_modulus * math.sin ( c.RotZ  ( math.pi / 2 ) )
autoRender(x)
#Reset camera pose
c.LocX = c_LocXInit
c.LocY = c_LocYInit
c.RotZ = c_RotZInit
for x in i7:
ob.RotX = math.pi / 180 * 17
c.RotZ = c_RotZInit + ( math.pi / 2 * ( x  i7[0] ) )
c.LocX = c_modulus * math.cos ( c.RotZ  ( math.pi / 2 ) )
c.LocY = c_modulus * math.sin ( c.RotZ  ( math.pi / 2 ) )
autoRender(x)
#Reset camera pose
c.LocX = c_LocXInit
c.LocY = c_LocYInit
c.RotZ = c_RotZInit
for x in i8:
ob.RotX =  ( math.pi / 180 * 22.5 )
c.RotZ = c_RotZInit + ( math.pi / 16 * ( x  i8[0] ) )
c.LocX = c_modulus * math.cos ( c.RotZ  ( math.pi / 2 ) )
c.LocY = c_modulus * math.sin ( c.RotZ  ( math.pi / 2 ) )
autoRender(x)
#Reset camera pose
c.LocX = c_LocXInit
c.LocY = c_LocYInit
c.RotZ = c_RotZInit
for x in i9:
ob.RotX = math.pi / 180 * 22.5
c.RotZ = c_RotZInit + ( math.pi / 16 * ( x  i9[0] ) )
c.LocX = c_modulus * math.cos ( c.RotZ  ( math.pi / 2 ) )
c.LocY = c_modulus * math.sin ( c.RotZ  ( math.pi / 2 ) )
autoRender(x)
#Reset camera pose
c.LocX = c_LocXInit
c.LocY = c_LocYInit
c.RotZ = c_RotZInit
if ((vehType == 3) or (vehType == 4) or (vehType == 5)):
for x in j1:
c.RotZ = c_RotZInit + ( math.pi / 16 * ( x  j1[0] ) )
c.LocX = c_modulus * math.cos ( c.RotZ  ( math.pi / 2 ) )
c.LocY = c_modulus * math.sin ( c.RotZ  ( math.pi / 2 ) )
autoRender(x)
#Reset camera pose
c.LocX = c_LocXInit
c.LocY = c_LocYInit
c.RotZ = c_RotZInit
for x in j2:
ob.RotX =  ( math.pi / 30 )
c.RotZ = c_RotZInit + ( math.pi / 2 * ( x  j2[0] ) )
c.LocX = c_modulus * math.cos ( c.RotZ  ( math.pi / 2 ) )
c.LocY = c_modulus * math.sin ( c.RotZ  ( math.pi / 2 ) )
autoRender(x)
#Reset camera pose
c.LocX = c_LocXInit
c.LocY = c_LocYInit
c.RotZ = c_RotZInit
for x in j3:
ob.RotX = math.pi / 30
c.RotZ = c_RotZInit + ( math.pi / 2 * ( x  j3[0] ) )
c.LocX = c_modulus * math.cos ( c.RotZ  ( math.pi / 2 ) )
c.LocY = c_modulus * math.sin ( c.RotZ  ( math.pi / 2 ) )
autoRender(x)
#Reset camera pose
c.LocX = c_LocXInit
c.LocY = c_LocYInit
c.RotZ = c_RotZInit
for x in j4:
ob.RotX =  ( math.pi / 180 * 11.5 )
c.RotZ = c_RotZInit + ( math.pi / 2 * ( x  j4[0] ) )
c.LocX = c_modulus * math.cos ( c.RotZ  ( math.pi / 2 ) )
c.LocY = c_modulus * math.sin ( c.RotZ  ( math.pi / 2 ) )
autoRender(x)
#Reset camera pose
c.LocX = c_LocXInit
c.LocY = c_LocYInit
c.RotZ = c_RotZInit
for x in j5:
ob.RotX = math.pi / 180 * 11.5
c.RotZ = c_RotZInit + ( math.pi / 2 * ( x  j5[0] ) )
c.LocX = c_modulus * math.cos ( c.RotZ  ( math.pi / 2 ) )
c.LocY = c_modulus * math.sin ( c.RotZ  ( math.pi / 2 ) )
autoRender(x)
#Reset camera pose
c.LocX = c_LocXInit
c.LocY = c_LocYInit
c.RotZ = c_RotZInit
for x in j6:
ob.RotX =  ( math.pi / 180 * 17 )
c.RotZ = c_RotZInit + ( math.pi / 2 * ( x  j6[0] ) )
c.LocX = c_modulus * math.cos ( c.RotZ  ( math.pi / 2 ) )
c.LocY = c_modulus * math.sin ( c.RotZ  ( math.pi / 2 ) )
autoRender(x)
#Reset camera pose
c.LocX = c_LocXInit
c.LocY = c_LocYInit
c.RotZ = c_RotZInit
for x in j7:
ob.RotX = math.pi / 180 * 17
c.RotZ = c_RotZInit + ( math.pi / 2 * ( x  j7[0] ) )
c.LocX = c_modulus * math.cos ( c.RotZ  ( math.pi / 2 ) )
c.LocY = c_modulus * math.sin ( c.RotZ  ( math.pi / 2 ) )
autoRender(x)
#Reset camera pose
c.LocX = c_LocXInit
c.LocY = c_LocYInit
c.RotZ = c_RotZInit
for x in j8:
ob.RotX =  ( math.pi / 180 * 22.5 )
c.RotZ = c_RotZInit + ( math.pi / 2 * ( x  j8[0] ) )
c.LocX = c_modulus * math.cos ( c.RotZ  ( math.pi / 2 ) )
c.LocY = c_modulus * math.sin ( c.RotZ  ( math.pi / 2 ) )
autoRender(x)
#Reset camera pose
c.LocX = c_LocXInit
c.LocY = c_LocYInit
c.RotZ = c_RotZInit
for x in j9:
ob.RotX = math.pi / 180 * 22.5
c.RotZ = c_RotZInit + ( math.pi / 2 * ( x  j9[0] ) )
c.LocX = c_modulus * math.cos ( c.RotZ  ( math.pi / 2 ) )
c.LocY = c_modulus * math.sin ( c.RotZ  ( math.pi / 2 ) )
autoRender(x)
#Reset camera pose
c.LocX = c_LocXInit
c.LocY = c_LocYInit
c.RotZ = c_RotZInit
if (vehType == 12):
for x in k1:
c.RotZ = c_RotZInit + ( math.pi / 16 * ( x  k1[0] ) )
c.LocX = c_modulus * math.cos ( c.RotZ  ( math.pi / 2 ) )
c.LocY = c_modulus * math.sin ( c.RotZ  ( math.pi / 2 ) )
autoRender(x)
#Reset camera pose
c.LocX = c_LocXInit
c.LocY = c_LocYInit
c.RotZ = c_RotZInit
if (vehType == 8):
for x in k2:
c.RotZ = c_RotZInit + ( math.pi / 2 * ( x  k2[0] ) )
c.LocX = c_modulus * math.cos ( c.RotZ  ( math.pi / 2 ) )
c.LocY = c_modulus * math.sin ( c.RotZ  ( math.pi / 2 ) )
autoRender(x)
#Reset camera pose
c.LocX = c_LocXInit
c.LocY = c_LocYInit
c.RotZ = c_RotZInit
# Reset object orientations
ob.RotX = 0
def main_o(ob):
global vehType
global b1, b2, i1, i2, i3, i4, i5, i6, i7, i8, i9, j1, j2, j3, j4, j5, j6, j7, j8, j9, k1, k2
if (vehType == 13):
for x in b1:
ob.RotZ =  ( math.pi / 16 * ( x  b1[0] ) )
autoRender(x)
for x in b2:
ob.RotX =  ( math.pi / 180 * 11.5 )
ob.RotZ =  ( math.pi / 16 * ( x  b2[0] ) )
autoRender(x)
if ((vehType == 1) or (vehType == 2) or (vehType == 6) or (vehType == 7) or (vehType == 9) or (vehType == 10) or (vehType == 11)):
for x in i1:
ob.RotZ =  ( math.pi / 32 * ( x  i1[0] ) )
autoRender(x)
if ((vehType == 1) or (vehType == 2) or (vehType == 7) or (vehType == 9) or (vehType == 10) or (vehType == 11)):
for x in i2:
ob.RotX =  ( math.pi / 30 )
ob.RotZ =  ( math.pi / 2 * ( x  i2[0] ) )
autoRender(x)
for x in i4:
ob.RotX =  ( math.pi / 180 * 11.5 )
ob.RotZ =  ( math.pi / 16 * ( x  i4[0] ) )
autoRender(x)
if ((vehType == 1) or (vehType == 2) or (vehType == 9) or (vehType == 10) or (vehType == 11)):
for x in i3:
ob.RotX = math.pi / 30
ob.RotZ =  ( math.pi / 2 * ( x  i3[0] ) )
autoRender(x)
for x in i5:
ob.RotX = math.pi / 180 * 11.5
ob.RotZ =  ( math.pi / 16 * ( x  i5[0] ) )
autoRender(x)
if (vehType == 2):
for x in i6:
ob.RotX =  ( math.pi / 180 * 17 )
ob.RotZ =  ( math.pi / 2 * ( x  i6[0] ) )
autoRender(x)
for x in i7:
ob.RotX = math.pi / 180 * 17
ob.RotZ =  ( math.pi / 2 * ( x  i7[0] ) )
autoRender(x)
for x in i8:
ob.RotX =  ( math.pi / 180 * 22.5 )
ob.RotZ =  ( math.pi / 16 * ( x  i8[0] ) )
autoRender(x)
for x in i9:
ob.RotX = math.pi / 180 * 22.5
ob.RotZ =  ( math.pi / 16 * ( x  i9[0] ) )
autoRender(x)
if ((vehType == 3) or (vehType == 4) or (vehType == 5)):
for x in j1:
ob.RotZ =  ( math.pi / 16 * ( x  j1[0] ) )
autoRender(x)
for x in j2:
ob.RotX =  ( math.pi / 30 )
ob.RotZ =  ( math.pi / 2 * ( x  j2[0] ) )
autoRender(x)
for x in j3:
ob.RotX = math.pi / 30
ob.RotZ =  ( math.pi / 2 * ( x  j3[0] ) )
autoRender(x)
for x in j4:
ob.RotX =  ( math.pi / 180 * 11.5 )
ob.RotZ =  ( math.pi / 2 * ( x  j4[0] ) )
autoRender(x)
for x in j5:
ob.RotX = math.pi / 180 * 11.5
ob.RotZ =  ( math.pi / 2 * ( x  j5[0] ) )
autoRender(x)
for x in j6:
ob.RotX =  ( math.pi / 180 * 17 )
ob.RotZ =  ( math.pi / 2 * ( x  j6[0] ) )
autoRender(x)
for x in j7:
ob.RotX = math.pi / 180 * 17
ob.RotZ =  ( math.pi / 2 * ( x  j7[0] ) )
autoRender(x)
for x in j8:
ob.RotX =  ( math.pi / 180 * 22.5 )
ob.RotZ =  ( math.pi / 2 * ( x  j8[0] ) )
autoRender(x)
for x in j9:
ob.RotX = math.pi / 180 * 22.5
ob.RotZ =  ( math.pi / 2 * ( x  j9[0] ) )
autoRender(x)
if (vehType == 12):
for x in k1:
ob.RotZ =  ( math.pi / 16 * ( x  k1[0] ) )
autoRender(x)
if (vehType == 8):
for x in k2:
ob.RotZ =  ( math.pi / 2 * ( x  k2[0] ) )
autoRender(x)
# Reset object orientations
ob.RotX = 0
ob.RotZ = 0
Register(draw, event, bevent)
Code: Select all
<!DOCTYPE html PUBLIC "//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta httpequiv="ContentType" content="text/html; charset=big5" />
<title>Sprite entries Generator</title>
</head>
<body>
<pre>
<script type="text/javascript" language="javascript">
//Parameters
var numsprites = 136; //Total number of sprite entries
var ioffset = 0; //Initial sprite index offset
var xofs = 110; //xofs
var yofs = 72; //yofs
var oname = "ROADBRT"; //Object Name
var stub = true; //Stubbed?
//Do not edit beyond this line
function PadDigits(n, totalDigits) {
n = n.toString();
while ( n.length < totalDigits ) {
n = '0' + n;
}
return n;
}
for(i=0;i<numsprites;i++){
document.write(" <\;sprite id="\;"+(i+ioffset)+""\; xofs="\;"+xofs+""\; yofs="\;"+yofs+""\;>\;<br />");
document.write(" <\;bit name="\;hasdata"\;>1<\;/bit>\;<br />");
document.write(" <\;bit name="\;chunked"\;>\;0<\;/bit>\;<br />");
document.write(" <\;bit name="\;copy"\;>0<\;/bit>\;<br />");
if (stub) {
document.write(" <\;stub>\;255<\;/stub>\;<br />");
} else {
document.write(" <\;pngfile>"+oname+"\\\\"+PadDigits(i,3)+".png<\;/pngfile>\;<br />");
}
document.write(" <\;/sprite>\;<br />");
}
</script>
</pre>
</body>
</html>
Last edited by K.Y.Chung on 14 Jan 2011 14:51, edited 7 times in total.
Visit Nanyue Express for my railway car drawings
Re: [Discussion] Sketchup, Blender, 3Dmax and other 3D programs
This, my friends, is exactly where my problems lie when it comes to modelling. I absolutely have no idea where to start! Programs like Blender and 3DsMax are just plain difficult to understand. Any reccomendations on where I should start?
Re: [Discussion] Sketchup, Blender, 3Dmax and other 3D programs
Just start out very slowly with the programs that are difficult to understand. Just little things like a cube, and then try to get it into the game, and see what happens from there. Remember there are plenty tutorials on how to use them, via youtube etc.
Re: [Discussion] Sketchup, Blender, 3Dmax and other 3D programs
Oh, boy! Tutorials on YouTube? Be sure to send me some links so I can see for myself!
Re: [Discussion] Sketchup, Blender, 3Dmax and other 3D programs
Or just find them yourself. Can't be that hard can it?tngjstn wrote:Oh, boy! Tutorials on YouTube? Be sure to send me some links so I can see for myself!
 My OTTD/TTDP pics Currently slighty obsessed with getting Platinum TrophiesRetired moderator
Re: [Discussion] Sketchup, Blender, 3Dmax and other 3D programs
Someone should make a tutorial for that. And put it on youtube.Badger wrote:Or just find them yourself. Can't be that hard can it?tngjstn wrote:Oh, boy! Tutorials on YouTube? Be sure to send me some links so I can see for myself!
In exile until I have time to live again.
[WIP] (on hold)  QLD Narrow Gauge Set/Sugar Cane Plantation
[WIP/Beta] (on hold)  Sydney Cityrail Platforms
[WIP]NSW Rollingstock
[WIP] (on hold)  QLD Narrow Gauge Set/Sugar Cane Plantation
[WIP/Beta] (on hold)  Sydney Cityrail Platforms
[WIP]NSW Rollingstock
Re: [Discussion] Sketchup, Blender, 3Dmax and other 3D programs
That is a brilliant idea! Youtube tutorials tend to be easier to follow, as locomotion is more of a visual strategy game.
Re: [Discussion] Sketchup, Blender, 3Dmax and other 3D programs
Let me post some old topics which is useful for newbies:
[MiniGuide]  How to make a train for Locomotion
(A rendering script for Maya and a standard palette is included)
3D Studio template scene for creating new vehicles in Loco
I remember that there is a rendering script for 3dmax with a fancy UI, but I can't find it.
[MiniGuide]  How to make a train for Locomotion
(A rendering script for Maya and a standard palette is included)
3D Studio template scene for creating new vehicles in Loco
I remember that there is a rendering script for 3dmax with a fancy UI, but I can't find it.
Visit Nanyue Express for my railway car drawings

 Chief Executive
 Posts: 675
 Joined: 20 Nov 2005 12:10
 Location: Australia; Melbourne
Re: [Discussion] Sketchup, Blender, 3Dmax and other 3D programs
Chung; I created a new .py file as stated, how ever I cant seem to find it in the scripts section; I use blender 2.49; and 2.5alpha2
also, I would like to know more about this script, does it mean we dont have to worry about moving the camera, we just have to make sure the object fills up the camera.
Or if possible, .rar up the code for us ..
well anyways, yer, Phython cant seem to find it..
Anyways, hope all goes well people.
also, I would like to know more about this script, does it mean we dont have to worry about moving the camera, we just have to make sure the object fills up the camera.
Or if possible, .rar up the code for us ..
well anyways, yer, Phython cant seem to find it..
Anyways, hope all goes well people.
Re: [Discussion] Sketchup, Blender, 3Dmax and other 3D programs
The script can be found on "Scripts">"Render" in the Scripts Window if it is being put to the correct place. In addition you can have a look on Wikibooks:
http://en.wikibooks.org/wiki/Blender_3D ... rt_scripts
If you really can't make it right you can just simply copy & paste all the codes into the Text Editor Window and then choose "Text">"Run Python Script", and it is what I did before when there is no UI foy my script.
All the things you need to make sure is to set your scene properly as stated in the documentation of the script itself. You can further verify just by pressing F12 to see whether you can get a proper render output as 000.png or not. The script will calculate the distance between the camera and the origin, then tell the camera to "walk around" the mesh object by 360*, while keeping the distance from origin constant.
There are 2 more screenshots FYI. I think just to have a try on it tells more than thousands of words. The worse case may just be getting 136 pieces of useless PNGs.
http://en.wikibooks.org/wiki/Blender_3D ... rt_scripts
If you really can't make it right you can just simply copy & paste all the codes into the Text Editor Window and then choose "Text">"Run Python Script", and it is what I did before when there is no UI foy my script.
All the things you need to make sure is to set your scene properly as stated in the documentation of the script itself. You can further verify just by pressing F12 to see whether you can get a proper render output as 000.png or not. The script will calculate the distance between the camera and the origin, then tell the camera to "walk around" the mesh object by 360*, while keeping the distance from origin constant.
There are 2 more screenshots FYI. I think just to have a try on it tells more than thousands of words. The worse case may just be getting 136 pieces of useless PNGs.
Visit Nanyue Express for my railway car drawings
Who is online
Users browsing this forum: No registered users and 3 guests