Page 2 of 2
Re: Making models in other than blender...
Posted: 24 Feb 2009 14:46
by Belgabor
SU (and Kerkythea) can render in parallel projection, which covers isometric and the special angle required for ttd/openttd. Setting the correct camera angle can be done with a script.
The newest beta of the Kerkythea exporter even correctly gets the setting from SU (Camera -> Parallel Projection), unfortunately it seems to interpret the distance wrong, so you end up zoomed in way too much (so far that at first I thought it was completely broken, but I just had to zoom out in K a lot

.
El'Muppo, the alpha is exactly what I mean, but afaik you cannot set it for the background.
Re: Making models in other than blender...
Posted: 24 Feb 2009 15:57
by trainboy2004
Belgabor wrote:Setting the correct camera angle can be done with a script.
Link please.

Re: Making models in other than blender...
Posted: 24 Feb 2009 16:02
by Belgabor
There is no existing script (at least not that I know), but the API is there
http://download.sketchup.com/OnlineDoc/ ... amera.html
You can get the current camera via
Code: Select all
Sketchup.active_model.active_view.camera
Re: Making models in other than blender...
Posted: 24 Feb 2009 16:05
by trainboy2004
Ok thanks.
But with pure luck I found this:
http://www.crai.archi.fr/RubyLibraryDep ... ameters.rb (save as)
http://www.crai.archi.fr/RubyLibraryDep ... m_page.htm
Only thing we now need is some XYZ coordinates in meters/inches for all the different camera positions. I know it's possible to export camera's in various formats. I don't know or it's possible to export multiple camera's in one file.
Re: Making models in other than blender...
Posted: 24 Feb 2009 16:13
by Belgabor
On a short test, something like
Code: Select all
Sketchup.active_model.active_view.camera = Sketchup::Camera.new(Geom::Point3d.new(10,10,5), Geom::Point3d.new(0,0,0), Geom::Vector3d.new(0,0,1), false)
might work. You should just need to adjust the cooridnates of the eye (first Point3d) to get the angle and distance right.
Edit: I'll have a loox at the blender file.
Re: Making models in other than blender...
Posted: 24 Feb 2009 17:21
by Belgabor
Proof-of-concept implementation.
Re: Making models in other than blender...
Posted: 24 Feb 2009 17:33
by trainboy2004
Nice concept, works fine
Test:
Re: Making models in other than blender...
Posted: 24 Feb 2009 19:04
by El'Muppo
Nice one

Re: Making models in other than blender...
Posted: 24 Feb 2009 19:39
by El'Muppo
Heres my try without any textures tho.

- Test.jpg (80.85 KiB) Viewed 7989 times
Re: Making models in other than blender...
Posted: 24 Feb 2009 23:08
by ArmEagle
trainboy2004 wrote:Nice concept, works fine
Test:

nice!

Back last year I wanted to play with 32bpp graphics and was totally annoyed by the totally ugly 8bpp catenary. So I started playing around in Gimp. Anyway, those poles really look bad, though I do like the wires. These are so much better though.
Aligning the poles can be quite tricky (or it's just me...). I spent quite some time trying to get it all right. Feel free to use my work in any way you could use it, even if it's just for the aligning:
http://www.tt-forums.net/viewtopic.php?p=709633#p709633
Btw, I used the Dutch Catenary GRF because I couldn't find the Sprite IDs for the catenary in the basic game.
Re: Making models in other than blender...
Posted: 25 Feb 2009 00:40
by trainboy2004
It was more to test/demonstrate the new concept plug-in from Belgabor, not to show my creation.

Re: Making models in other than blender...
Posted: 25 Feb 2009 05:12
by Belgabor
There's still some things that should go into the script, like zooming the camera (doing that manually without loosing your lookat is nigh-impossible).
It's also a pity that the free SU version cannot render a transparent background, at least on Windows (the Mac version reportedly can, as can the Pro version with a work-around using layout). I think the Sketchup look might work well for 32bpp toyland.
Re: Making models in other than blender...
Posted: 25 Feb 2009 05:17
by El'Muppo
What about right spot for the sun ?
I bet its loads of information about it in the forums but since its a big maze for me i just wanted to bring up that part, its able to put that stuff in the ruby aswell right?
Re: Making models in other than blender...
Posted: 22 Apr 2010 15:39
by CharlieMTA
Since earlier in the thread you were looking for the exact input values:
Directions for sketchup using the camera positioning script. Ignore everything about indexed 256 color if this is for only 32bit.
Set the model units to metric
Go to Camera->Toggle OFF perspective, this is important
Go to Camera->Target (an option added by the script) and set the position values as follows
20, -20, 16.3
The target should be the origin at 0,0,0
Focal angle doesn't matter
The produced images, with 3rd party textures are suitable for OTTD, or if you use color by layer /materials set to the TTD palette you can do TTDP buildings with some resizing, palette adjustment (photoshop works best to avoid dithering problems), and some recoloring to recover any lost details. If you want to avoid some of this, try setting your desktop to 256 index color depth in the control panel.
Location and setting the position of the sun is under the window->model info->location tab. Tick on show in model and select will allow you to set the angle of the sun direction wise while the geographic location will set the sun's height in the sky.
Almost forgot go into view->rendering and shut off profile edges
Then it is a personal preference for the appearence but also tick off display edges OR go into window->display settings and change edge color from All Same to By Material
Otherwise your image will have thick black lines around the corners and details when you shrink the exported images to fit TTD scale and go into TTDX indexed color.
Put this in a text file and save it as "camera_parameters.rb" to the scripts folder of sketchup.
# cameraparams.rb
# Version of 09/07/04
# Copyright 2004 Envision 3D Limited
# Set camera parameters in sketchup
require 'sketchup.rb'
# Set camera parameters using viewpoint and target
def camera_vp_targ
model = Sketchup.active_model
view = model.active_view
camera = view.camera
# Get camera viewpoint and target
eye = camera.eye
vx = eye.x
vy = eye.y
vz = eye.z
target = camera.target
tx = target.x
ty = target.y
tz = target.z
# fov property is VFOV not HFOV
vfovdeg = camera.fov
# Viewport size
w = Float(view.vpwidth)
h = Float(view.vpheight)
# Work out HFOV from VFOV and viewport size
vfovrad = vfovdeg*Math::PI/180.0
f = (h/2)/Math.tan(vfovrad/2.0)
hfovrad = 2.0*Math.atan2((w/2),f)
hfovdeg = hfovrad*180.0/Math::PI
# Dialogue box
prompts = ["Position X", "Position Y", "Position Z", "Target X", "Target Y", "Target Z", "Focal angle"]
values = [vx, vy, vz, tx, ty, tz, hfovdeg]
results = inputbox prompts, values, "Camera point of view/ Target"
# Read back new values
vx, vy, vz, tx, ty, tz, hfovdeg = results
# New viewpoint and target
eye.x = vx
eye.y = vy
eye.z = vz
target.x = tx
target.y = ty
target.z = tz
# Up vector is straight up
up = camera.up
up.set!(0.0, 0.0, 1.0)
# Set new parameters
camera.set eye, target, up
# Work out VFOV from HFOV and viewport size
hfovrad = hfovdeg*Math::PI/180.0
f = (w/2)/Math.tan(hfovrad/2.0)
vfovrad = 2.0*Math.atan2((h/2),f)
vfovdeg = vfovrad*180.0/Math::PI
# Apply to camera
camera.fov = vfovdeg
end
# Set camera parameters using viewpoint, azimuth and elevation
def camera_vp_az_el
model = Sketchup.active_model
view = model.active_view
camera = view.camera
# Get camera viewpoint and target
eye = camera.eye
vx = eye.x
vy = eye.y
vz = eye.z
target = camera.target
tx = target.x
ty = target.y
tz = target.z
# Work out azimuth and elevation angles
if vx == tx && vy == ty then
az = 0
if vz > tz then
el = -90.0
else
el = 90.0
end
else
az = Math.atan2(tx-vx,ty-vy)*180.0/Math::PI
if az < 0.0 then
az = az+360.0
end
el = Math.atan2((tz-vz),Math.sqrt((tx-vx)*(tx-vx)+(ty-vy)*(ty-vy)))*180.0/Math::PI
end
# fov property is VFOV not HFOV
vfovdeg = camera.fov
# Viewport size
w = Float(view.vpwidth)
h = Float(view.vpheight)
# Work out HFOV from VFOV and viewport size
vfovrad = vfovdeg*Math::PI/180.0
f = (h/2)/Math.tan(vfovrad/2.0)
hfovrad = 2.0*Math.atan2((w/2),f)
hfovdeg = hfovrad*180.0/Math::PI
# Dialogue box
prompts = ["Position X", "Position Y", "Position Z", "Azimuth", "Elevation", "Focal angle"]
values = [vx, vy, vz, az, el, hfovdeg]
results = inputbox prompts, values, "Camera point of view/ Target"
# Read back new values
vx, vy, vz, az, el, hfovdeg = results
# New viewpoint
eye.x = vx
eye.y = vy
eye.z = vz
# Work out the length of the viewpoint-target vector
# but use 10 metres if it's presently zero.
vdist = Math.sqrt((tx-vx)*(tx-vx)+(ty-vy)*(ty-vy)+(tz-vz)*(tz-vz))
if vdist == 0.0 then
vdist = 10.0
end
# Special case if elevation is straight up or down.
if el >= 89.9 then
tx = vx
ty = vy
tz = vz+vdist
elsif el <= -89.9 then
tx = vx
ty = vy
tz = vz-vdist
# Otherwise calculate new target from azimuth and elevation.
else
vectx = Math.sin(az*Math::PI/180.0)
vecty = Math.cos(az*Math::PI/180.0)
vectz = Math.sqrt(vectx*vectx+vecty*vecty)*Math.tan(el*Math::PI/180.0)
veclen = Math.sqrt(vectx*vectx+vecty*vecty+vectz*vectz)
tx = vx+vectx*vdist/veclen
ty = vy+vecty*vdist/veclen
tz = vz+vectz*vdist/veclen
end
# New target position
target.x = tx
target.y = ty
target.z = tz
# Up vector is straight up
up = camera.up
up.set!(0.0, 0.0, 1.0)
# Set new parameters
camera.set eye, target, up
# Work out VFOV from HFOV and viewport size
hfovrad = hfovdeg*Math::PI/180.0
f = (w/2)/Math.tan(hfovrad/2.0)
vfovrad = 2.0*Math.atan2((h/2),f)
vfovdeg = vfovrad*180.0/Math::PI
# Apply to camera
camera.fov = vfovdeg
end
# Put menu items for script on end of Camera menu
if( not file_loaded?("camera_parameters.rb") )
add_separator_to_menu("Camera")
UI.menu("Camera").add_item("Camera / Target") { camera_vp_targ }
UI.menu("Camera").add_item("Camera / Azimuth / Elevation") { camera_vp_az_el }
end
file_loaded("camera_parameters.rb")
Re: Making models in other than blender...
Posted: 22 Apr 2010 15:50
by El'Muppo
Nice Thank you for the information, time to try it out

Re: Making models in other than blender...
Posted: 24 Apr 2010 09:36
by lead@inbox
Sketchup can speed up grafics development
Sketchup
ruby plugin for sketchup
models in
3D warehouse
Re: Making models in other than blender...
Posted: 24 Apr 2010 09:54
by Jupix
Taking someone's artwork from an online 3D library and rendering it with our camera settings does not mean you've reduced the time it takes to create OTTD graphics to 1 minute.
If the source was GPL compatible, then maybe it could be adapted for our uses.
Re: Making models in other than blender...
Posted: 24 Apr 2010 09:59
by planetmaker
Jupix wrote:Taking someone's artwork from an online 3D library and rendering it with our camera settings does not mean you've reduced the time it takes to create OTTD graphics to 1 minute.
If the source was GPL compatible, then maybe it could be adapted for our uses.
Hehe. Especially as the shown airbus has a right wing which is about 1.5 times the length of the left wing

Re: Making models in other than blender...
Posted: 24 Apr 2010 10:17
by lead@inbox
planetmaker wrote:.. has a right wing which is about 1.5 times the length of the left wing

- parallel projections (this settings are in ruby plugin). About copyrights and etc - i mean only development time, nothing else, sketchup can improve it.