[Discussion] Sketchup, Blender, 3Dmax and other 3D programs

Discuss, get help with, or post new modifications, graphics or related tools for Locomotion in this forum.

Moderator: Locomotion Moderators

lego_trains
Traffic Manager
Traffic Manager
Posts: 223
Joined: 09 Dec 2007 22:29

Re: [Discussion] Sketchup, Blender, 3Dmax and other 3D programs

Post by lego_trains »

Can you translate that to English?

This my friend, is why I don't use Sketchup.
_______________________________________________________
Member of Chicago Locomotive Works.
Image
User avatar
Opan
Chairman
Chairman
Posts: 856
Joined: 06 Mar 2010 22:34

Re: [Discussion] Sketchup, Blender, 3Dmax and other 3D programs

Post by Opan »

Which program do you use lego? (I'm assuming blender or 3dsm)
lego_trains
Traffic Manager
Traffic Manager
Posts: 223
Joined: 09 Dec 2007 22:29

Re: [Discussion] Sketchup, Blender, 3Dmax and other 3D programs

Post by lego_trains »

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.
Image
X.G.fr0sty
Chief Executive
Chief Executive
Posts: 675
Joined: 20 Nov 2005 12:10
Location: Australia; Melbourne

Re: [Discussion] Sketchup, Blender, 3Dmax and other 3D programs

Post by X.G.fr0sty »



Is it me; or does it look like silk?
Image
User avatar
Opan
Chairman
Chairman
Posts: 856
Joined: 06 Mar 2010 22:34

Re: [Discussion] Sketchup, Blender, 3Dmax and other 3D programs

Post by Opan »

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.
X.G.fr0sty
Chief Executive
Chief Executive
Posts: 675
Joined: 20 Nov 2005 12:10
Location: Australia; Melbourne

Re: [Discussion] Sketchup, Blender, 3Dmax and other 3D programs

Post by X.G.fr0sty »

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. :wink: (Thanks for reminding me)
Image
User avatar
Opan
Chairman
Chairman
Posts: 856
Joined: 06 Mar 2010 22:34

Re: [Discussion] Sketchup, Blender, 3Dmax and other 3D programs

Post by Opan »

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?
X.G.fr0sty
Chief Executive
Chief Executive
Posts: 675
Joined: 20 Nov 2005 12:10
Location: Australia; Melbourne

Re: [Discussion] Sketchup, Blender, 3Dmax and other 3D programs

Post by X.G.fr0sty »

What you should do, is attach the light(sun, or lamp) to the camera...
Image
User avatar
Hammo
Director
Director
Posts: 574
Joined: 08 May 2008 07:01
Location: /home/root

Re: [Discussion] Sketchup, Blender, 3Dmax and other 3D programs

Post by Hammo »

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.
test render of a WIP NSWGR NHFF coal hopper
test render of a WIP NSWGR NHFF coal hopper
Image00.png (78.05 KiB) Viewed 27206 times
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...
render of NHFF WIP after MAX import
render of NHFF WIP after MAX import
NHFF test render.png (57.11 KiB) Viewed 27206 times
User avatar
Krakr
Engineer
Engineer
Posts: 62
Joined: 11 Feb 2010 06:09
Location: Middle America

Re: [Discussion] Sketchup, Blender, 3Dmax and other 3D programs

Post by Krakr »

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 built-in 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.
Goal was for a weathered look.
WT Snapshot 1.png (121.59 KiB) Viewed 27154 times
Corral those nutty peeps with a Boundary Fence
Replace wimpy steamer sounds with Steamer Sound Kit
K.Y.Chung
Transport Coordinator
Transport Coordinator
Posts: 350
Joined: 03 Oct 2009 09:30
Contact:

Re: [Discussion] Sketchup, Blender, 3Dmax and other 3D progr

Post by K.Y.Chung »

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.

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 y-axis 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 %x1|Railway Cars (Tilt Trains) %x9|Railway Cars (Tilt Trains banking left) %x10|Railway Cars (Tilt Trains banking right) %x11|Railway Car Bogies %x13|Narrow Gauge Railway Cars %x2|Road Vehicles %x3|Braking Lights of Road Vehicles %x4|Trams %x5|Ships %x6|Aircrafts %x7|Aircraft Shadows %x12|Buildings %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 %x1|Camera %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%t|Select 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)
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.

Code: Select all

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
	<head>
		<meta http-equiv="Content-Type" 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("	&lt\;sprite id=&quot\;"+(i+ioffset)+"&quot\; xofs=&quot\;"+xofs+"&quot\; yofs=&quot\;"+yofs+"&quot\;&gt\;<br />");
	document.write("		&lt\;bit name=&quot\;hasdata&quot\;>1&lt\;/bit&gt\;<br />");
	document.write("		&lt\;bit name=&quot\;chunked&quot\;&gt\;0&lt\;/bit&gt\;<br />");
	document.write("		&lt\;bit name=&quot\;copy&quot\;>0&lt\;/bit&gt\;<br />");
	if (stub) {
		document.write("		&lt\;stub&gt\;255&lt\;/stub&gt\;<br />");
	} else {
		document.write("		&lt\;pngfile>"+oname+"\\\\"+PadDigits(i,3)+".png&lt\;/pngfile&gt\;<br />");
	}
	document.write("	&lt\;/sprite&gt\;<br />");
}
			</script>
		</pre>
	</body>
</html>
I hope all of you may find them useful.
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
User avatar
tngjstn
Engineer
Engineer
Posts: 43
Joined: 31 Dec 2009 04:41
Location: Southern California

Re: [Discussion] Sketchup, Blender, 3Dmax and other 3D programs

Post by tngjstn »

:?:
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?
User avatar
Opan
Chairman
Chairman
Posts: 856
Joined: 06 Mar 2010 22:34

Re: [Discussion] Sketchup, Blender, 3Dmax and other 3D programs

Post by Opan »

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.
User avatar
tngjstn
Engineer
Engineer
Posts: 43
Joined: 31 Dec 2009 04:41
Location: Southern California

Re: [Discussion] Sketchup, Blender, 3Dmax and other 3D programs

Post by tngjstn »

Oh, boy! Tutorials on YouTube? Be sure to send me some links so I can see for myself!
User avatar
Badger
Tycoon
Tycoon
Posts: 7040
Joined: 10 Sep 2006 19:12
Location: Adwick-Le-Street.

Re: [Discussion] Sketchup, Blender, 3Dmax and other 3D programs

Post by Badger »

tngjstn wrote:Oh, boy! Tutorials on YouTube? Be sure to send me some links so I can see for myself!
Or just find them yourself. Can't be that hard can it?
|||| My OTTD/TTDP pics ||||Currently slighty obsessed with getting Platinum Trophies||||Retired moderator||||
User avatar
Hammo
Director
Director
Posts: 574
Joined: 08 May 2008 07:01
Location: /home/root

Re: [Discussion] Sketchup, Blender, 3Dmax and other 3D programs

Post by Hammo »

Badger wrote:
tngjstn wrote:Oh, boy! Tutorials on YouTube? Be sure to send me some links so I can see for myself!
Or just find them yourself. Can't be that hard can it?
Someone should make a tutorial for that. And put it on youtube.
User avatar
tngjstn
Engineer
Engineer
Posts: 43
Joined: 31 Dec 2009 04:41
Location: Southern California

Re: [Discussion] Sketchup, Blender, 3Dmax and other 3D programs

Post by tngjstn »

:idea: That is a brilliant idea! Youtube tutorials tend to be easier to follow, as locomotion is more of a visual strategy game.
K.Y.Chung
Transport Coordinator
Transport Coordinator
Posts: 350
Joined: 03 Oct 2009 09:30
Contact:

Re: [Discussion] Sketchup, Blender, 3Dmax and other 3D programs

Post by K.Y.Chung »

Let me post some old topics which is useful for newbies:

[Mini-Guide] - 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
X.G.fr0sty
Chief Executive
Chief Executive
Posts: 675
Joined: 20 Nov 2005 12:10
Location: Australia; Melbourne

Re: [Discussion] Sketchup, Blender, 3Dmax and other 3D programs

Post by X.G.fr0sty »

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 :P..

well anyways, yer, Phython cant seem to find it..

Anyways, hope all goes well people.
Image
K.Y.Chung
Transport Coordinator
Transport Coordinator
Posts: 350
Joined: 03 Oct 2009 09:30
Contact:

Re: [Discussion] Sketchup, Blender, 3Dmax and other 3D programs

Post by K.Y.Chung »

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. :lol:
Attachments
answer1.png
answer2.png
Visit Nanyue Express for my railway car drawings
Post Reply

Return to “Locomotion Graphics, Modifications & Tools”

Who is online

Users browsing this forum: No registered users and 4 guests