Notifications
Clear all

To all SSC Station occupants

Thank you for the donations over the past year (2024), it is much appreciated. I am still trying to figure out how to migrate the forums to another community software (probably phpbb) but in the meantime I have updated the forum software to the latest version. SSC has been around a while so their is some very long time members here still using the site, thanks for making SSC home and sorry I haven't been as vocal as I should be in the forums I will try to improve my posting frequency.

Thank you again to all of the members that do take the time to donate a little, it helps keep this station functioning on the outer reaches of space.

-D1-

modeling for pioneer

Page 3 / 10
(@potsmoke66)
Noble Member

not that good after all, i see a lot of stunning models used for orbiter make me feel small.

ok, poly count must be enormeous for some, but looking great.

well i have a lot of time to spend for it, because i'm still unemployed. if i would have to work i wouldn't find the time to do so much, or i would have to stop sleeping 😆

ReplyQuote
Topic starter Posted : August 5, 2010 07:08
(@marcel)
Noble Member

Ah unemployment, a boon for productivity. Yeah, my avatar is a pic of my first Orbiter rendezvous. I was thinking that F19 would make a cool Pioneer fighter. I'd like to make one based on a die-cast toy I have on my desk, but I waste a lot of my time at work. 😀

ReplyQuote
Posted : August 5, 2010 19:28
(@potsmoke66)
Noble Member

some commands you won't find in the wiki (mainly "matrix.xxx" for loadet .obj meshes and some other parts);

addendum: LUA commands for models

sphere commands:

sphere(number of subdivisions, optional transform matrix)

sphere is a sub-divided icosahedron. number of divisions can be from 0

to 4 (where zero gives an icosahedron and 4 gives a very smooth sphere).

sphere_slice(longitude steps, latitude steps, slice angle1, slice angle2, optional transform matrix)

will draw a slice of a sphere. Angles are in radians.

sphere_slice(20, 20, 0, 3.141)

will draw a full sphere

sphere_slice(20, 20, 0, 0.5*3.141) or

sphere_slice(2*lod, 1*lod, 0, 0.5*math.pi, Matrix.new (v(1,0,0), v(0,1,0), v(0,0,1))) use Matrix for deformation

will draw a half sphere

sphere_slice(20, 20, 0.1*3.141, 0.9*3.141)

will draw a sphere with a slice at the top and bottom cut off it

Matrix commands:

Matrix.new(v(1,0,0), v(0,1,0), v(0,0,1))

Defines a new Matrix for a part (.obj) (scale & orientation, alters normals)

Matrix.scale(v(0.5,0.5,0.5))

Scales all vectors by 0.5

Matrix.translate(v(10,0,0))

Moves vector x by 10 to right side

Matrix.rotate(0.5*math.pi,v(0,1,0))

Rotates 90° along vector y

Matrix.orient(v(1,0,0), v(0,1,0), v(0,0,1))

orients part (object) along x,y,z axes (turns axes around and displaces part by entered amount, makes normals unidirectional)

hint, place a Matrix.scale best at last in row, because it will scale ALL vectors,

translate and rotate vectors will be scaled to if entered "scale" before them.

you can get a advance of that if you first rotate a sphere(_slice) then scale and rotate again,

after you get a egg shape (one side acute, the other flat).

wherefore Matrix.new will scale only the mesh/part

use multiple instances of Matrix.xxx for a mesh in the following way

load_obj('any.obj', Matrix.new(v(-1,0,0),v(0,1,0),v(0,0,-1)) * Matrix.rotate(.5*math.pi,v(0,1,0)) * Matrix.scale(v(.5,.5,.5)))

Matrix.xxx can be used mainly for .obj meshes and some other scripted parts, refer to the pioneer developers wiki

http://pioneerspacesim.net/wiki/index.p ... =Main_Page

call a model and rotate it:

general (pressbutton 😉 )

rotation is on y axis, so model must be oriented y = z for a rotation around z axis!

pre_rotate a mesh in your cad program best in advance to that or use Matrix.rotate to position z upwards

create submodels in desired orientation, before you use them by "call_model", for rotation.

a loadet mesh's "world" center will allways be it's rotation axis (pivot point)! so best center .obj at desired

rotation piont to "world" (check the lanners uc flaps or couriers engine tip as example).

local dings_angle = 0.5*math.pi*math.clamp(get_arg(0)), 0, 1)

for a limited uc animation, or

local dings = math.pi*(get_arg(1))

for a free game time dependant animation (e.g. a clock), or

local bums = 0.5*math.pi*(os.clock())

for a free os clock (system clock frequency) dependant animation (for a nonstop, continous speed animation)

if os.clock() has no arguments os clock base frequency is used, can have a argument for hours, mins, sec.

example,

call_model('some_part', v(x,y,z position), (0,0,1), v(math.cos(dings_angle), math.sin(dings_angle), 0), 1)

will end in a by uc animation counter limited animation (see "local dings_angle") around z axis, typical for a uc flap.

local handPos = -2*math.pi * get_arg(3)

call_model('clkmin', v(0,0,0), v(math.cos(handPos),math.sin(handPos),0), v(math.cos(handPos+math.pi*0.5), math.sin(handPos+math.pi*0.5),0), 1)

handPos = handPos / 12

call_model('clkhr', v(0,0,0), v(math.cos(handPos),math.sin(handPos),0), v(math.cos(handPos+math.pi*0.5), math.sin(handPos+math.pi*0.5),0), 1)

will animate a clock showing game time mins & hours

not well explained commands:

flat(integer divs, vector normal, {v_line}, draws a line from/to previous/next vector or from/to prev./next geometry

{v_quadric_start, v_quadric_endpoint}, draws a quadric bezier tri from/to previous....

{v_cubic1, v_cubic2, v_cubic_endppoint}, draws a cubic bezier tri from/to previous....

etc.... (does that mean it can be expandet to quadric bez. quad, cubic bez. quad?)

example,

eagle body & wing part,

local v0 = v(0,0,-40)

local v2 = v(0,6,25)

local v6 = v(31,0,-9)

local v8 = v(3,0,12)

local v10 = v(9,0,-37)

local v14 = v(31,1,9)

flat(6*lod, v(0,1,0), {v2}, {v14}, {v6}, {v8, v10, v0})

draws the surface on the right side from back middle to back wingtip to front wingtip, draws then a cubic tri to finish the shape

(pioneers models have to be drawn counterclockwise, in difference to FE2 which are clockwise drawn,

if you take coordinates from the original game, based on theunis meshview.txt assume that he listed x,y,z wrong at first,

you will have to turn coordinates around in list, x=z, y=y, z=x, further to respect pioneers righthanded system

you have to negate all z coordinates, -z becomes +z and vice versa)

cubic_bezier_quad:

imagine a grid, with 16 nodes, based on a cubic bezier curve (1 start 2 curve nodes 1 end)

the eagles fuelscoop as example

th_cubic_bezier_quad.jpg

quadric_bezier_quad:

imagine a grid with 4 nodes and 5 to determine the curves of the surface, based on a simple quadric bezier curve (start, curve, end).

this egg like shape you find in pimodels.lua ’test’

disabled as a comment, uncomment it to make it visible

or paste to a separate .lua and specify as ’any model’

th_quadric_bezier_quad.jpg

cubic_bezier_tri:

also from ’test’

disabled as a comment, uncomment it to make it visible

or paste to a separate .lua and specify as ’any model’

th_cubic_bezier_tri.jpg

quadric_bezier_tri:

another example from ’test’

th_quadric_bezier_tri.jpg

prev. unexplained functions and commands:

normal(x,y,z) instead of v(x,y,z), defines the vectors for the normals of a geometry

(havn't found out proper how to use by now)

cuboid(pos, size)

creates a simple cube

global arguments used for models:

get_arg_string(), by now only "0" for the ships registration no.

get_arg(0), the UC release counter

get_arg("1-4"), the game time, sec., min., hrs., day.

get_arg("5-9"), used for the docking procedure, works only for models defined as 'surface_station' or 'orbital_station'

further help:

you can use all lua and lua compliant c commands refer to the help in LuaEdit or to this pages

http://pgl.yoyo.org/luai/i/_

http://luanet.net/lua

a few helpful ones:

math.pi, generates the number pi

math.random & math.randomseed, radomize a number based on a seeding, equal seeded number results in equal random result.

math.fmod, divide a number or expressions output by a given divisor math.fmod(x,1) will output the fractals of one divided with x, handy for a counter or such. i.e. math.fmod(os.clock(),1) will count in the system clockspeed in decimal fractals of 1 from 0 to 1. useful for lerp_material (blend materials) or if you like vlerp (blend vectors).

math.modf, separates integers from fractals

os.clock(), returns operating systems clock count from call on

ReplyQuote
Topic starter Posted : August 19, 2010 04:28
 tomm
(@tomm)
Estimable Member
potsmoke66 wrote:
some commands you won't find in the wiki (mainly "matrix.xxx" for loadet .obj meshes and some other parts);

That looks good, except that normal(x,y,z) is the same as vector(x,y,z):norm(). It is useful where you need to provide normalized vertices (which isn't so often). Perhaps the name is confusing and it should be removed.

ReplyQuote
Posted : August 19, 2010 05:10
(@potsmoke66)
Noble Member

i should have said i have no idea....

no i have a idea, but never tried to succsessfully use it.

further zbias is a bit a riddle to me i never found a useful instance

first i assumed it will determine rotation piont, but after a few experiments, i recognized that it has no influence on that (or i did it the wrong way, what easely could be), so i'm not quite shure what it's good for...

ReplyQuote
Topic starter Posted : August 19, 2010 05:23
(@potsmoke66)
Noble Member

something i forgot to tell

it took my a week of investigations in the web to find a proper explanation for a cubic bezier quad that has helped me to understand the system is used for that and the system of bezier curves used for shapes at all.

most came of with some mathematical explanations to that (since you can use this not only for shapes it's also used as a abstract mathematical function).

actually i can't fin that page again 🙁

but just to tell it was the first one that showed me a grid using the 16 points like i showed in my little sketch in the prev. posting and not only a the math. expression of it. some just reply what they have been teached without guessing for a explanation, because they don't know themselfes, that's a very widely spread problem i guess. to explain that a bit someone might have asked in a forum for exactly this "how is a cubic bez. quad build" , and they answered with a math. expression.

some should not forget that there are practical things behind (in front of) a theory.

it's like someone would ask me how to make a Tie-Dye and i would answer with the difference between a electrolytical bond and a true chemical reaction, wrong answer man. (the invention of reactive colors back in the 60's has made this former asian silk dying method possible for cotton and so for t-shirts, with common colors this would be a difficult task on cotton. to go a little further, yes you can use other classes like pigments that are "glued" on the fabric, but it will never give you such nice results).

ReplyQuote
Topic starter Posted : August 21, 2010 19:15
(@s2odan)
Noble Member

I finally got round to porting one of my models over to pioneer heres some pics:

modelviewer-msvc-9%202010-09-08%2001-19-33-06.jpg

modelviewer-msvc-9%202010-09-08%2001-19-48-30.jpg

modelviewer-msvc-9%202010-09-08%2001-19-52-58.jpg

The model viewer can load the model up, but when I try to test it in the game, it just crashes.

Here is the model file in spoiler tags:

Code:

define_model('dg', {
info = {
scale = 9.00,
bounding_radius = 30,
materials={'courier', 'color1', 'color2', 'grey', 'nazzle'},

},

static = function(lod)

set_material('courier', .63,.7,.83,1,1.26,1.4,1.66,30)
set_material('color1', .35,.1,.15,1,1,.85,.9,100)
set_material('color2', .15,.1,.35,1,.90,.85,1,100)
set_material('grey', .3,.3,.3,1,.3,.3,.3,10)
set_material('nazzle', .63,.7,.83,1,1.26,1.4,1.66,10)

use_material('courier')

texture('delta.png')
load_obj('delta2.obj')

end
})

define_model('delta', {
info = {
scale = 1.00,
bounding_radius = 30,
materials={'courier', 'color1', 'color2', 'grey', 'nazzle'},
tags = { 'ship' },
ship_defs = {
{
'Delta Glider',
{ 12*10^6,-12*10^6,4*10^6,-4*10^6,-4*10^6,4*10^6 },
1*10^7,
{
{ v(0,-0.5,0), v(0,0,-1) },
{ v(0,0,0), v(0,0,1) },
},
{ 320, 1, 2, 6, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 },
320, 300, 35000,
5
}
}
},

static = function(lod)

set_material('courier', .63,.7,.83,1,1.26,1.4,1.66,30)
set_material('color1', .35,.1,.15,1,1,.85,.9,100)
set_material('color2', .15,.1,.35,1,.90,.85,1,100)
set_material('grey', .3,.3,.3,1,.3,.3,.3,10)
set_material('nazzle', .63,.7,.83,1,1.26,1.4,1.66,10)

use_material('courier')

texture('delta.png')

call_model('dg', v(0,0,0), v(1,0,0), v(0,1,0),1)

local vMainThruster = v(0,0,5)
local vForwardThruster1 = v(-0.3,0.6,5.5)
local vForwardThruster2 = v(-0.73,0.1,5.5)
local vForwardThruster3 = v(-0.95,-0.34,5.5)
local vForwardThruster4 = v(0.3,0.6,5.5)
local vForwardThruster5 = v(0.73,0.1,5.5)
local vForwardThruster6 = v(0.95,-0.34,5.5)
local vRetroThruster1 = v(-1.2,0.1,1.5)
local vRetroThruster2 = v(1.2,0.1,1.5)

local v1 = v(0,0.1,-2) --TEMPORARY
local v2 = v(0,0.1,3) --TEMPORARY

local v32 = v(-9.0, 5.0, -30.0)
-- 32, right TEMPORARY
local v33 = v(-12.0, -5.0, 30.0)
local v34 = v(12.0, -5.0, -30.0)
-- 34, left TEMPORARY
local v35 = v(9.0, 5.0, 30.0)
local v36 = v(0.0, 12.0, -30.0)
-- 36, top TEMPORARY
local v37 = v(0.0, 12.0, 30.0)
local v38 = v(0.0, -12.0, -30.0)
-- 38, bottom TEMPORARY
local v39 = v(0.0, -12.0, 30.0)

thruster(vMainThruster, v(0,0,1), 7, true)
thruster(vRetroThruster1, v(-0.2,0.2,-1), 3, true)
thruster(vRetroThruster2, v(0.2,0.2,-1), 3, true)

thruster(vForwardThruster1, v(0,0,1), 2, true)
thruster(vForwardThruster2, v(0,0,1), 2, true)
thruster(vForwardThruster3, v(0,0,1), 2, true)
thruster(vForwardThruster4, v(0,0,1), 2, true)
thruster(vForwardThruster5, v(0,0,1), 2, true)
thruster(vForwardThruster6, v(0,0,1), 2, true)

thruster(v32, v(-1,0,0), 25) --temp
thruster(v33, v(-1,0,0), 25)
thruster(v34, v(1,0,0), 25)
thruster(v35, v(1,0,0), 25)
thruster(v36, v(0,1,0), 25)
thruster(v37, v(0,1,0), 25)
thruster(v38, v(0,-1,0), 25)
thruster(v39, v(0,-1,0), 25) --temp

end
})

I know I don't have landing gear yet, could that be what is causing the crash? Does anyone have any ideas?

Cheers.

ReplyQuote
Posted : September 7, 2010 16:29
(@marcel)
Noble Member

Potsmoke, I want to report to you that after several hours of a steep learning curve spread over many weeks, I got a separate LuaEdit/Model Viewer folder setup, and have made some slight progress. I've found all the faces of the Ladybird, and have applied one of your textures to each of them. Now I'll learn to size them, then I'll make some of my own. I've replaced my ships.lua with this one and it displays in the shipyard!

ReplyQuote
Posted : September 7, 2010 16:40
(@s2odan)
Noble Member

Ive been trying to add some landing gear but I'm messing it up somewhere along the line, I would very much appreciate it if someone could look at this:

EDIT// Managed to fix (I think) the landing gear.

Code:

define_model('dg', {
info = {
scale = 9.00,
bounding_radius = 30,
materials={'courier', 'color1', 'color2', 'grey', 'nazzle'},

},

static = function(lod)

set_material('courier', .63,.7,.83,1,1.26,1.4,1.66,30)
set_material('color1', .35,.1,.15,1,1,.85,.9,100)
set_material('color2', .15,.1,.35,1,.90,.85,1,100)
set_material('grey', .3,.3,.3,1,.3,.3,.3,10)
set_material('nazzle', .63,.7,.83,1,1.26,1.4,1.66,10)

use_material('courier')

texture('delta.png')
load_obj('delta2.obj')

end
})

define_model('nosewheel', {
info = {
lod_pixels={5,50,0},
bounding_radius = 7,
materials={'leg','tyre'}
},
static = function(lod)
set_material('leg', .5, .5, .5, 1, .5, .5, .5, 2.0, 0, 0, 0)
set_material('tyre', .3, .3, .3, 1, 0,0,0, 1, 0, 0, 0)
use_material('leg')
local v6 = v(0, 0, 0)
local v7 = v(0, 3, 0)
local v8 = v(0, 5, 0)
local divs = lod*4
cylinder(divs, v6, v8, v(0,0,1), .4)
cylinder(divs, v7, v8, v(0,0,1), .5)
use_material('tyre')
xref_cylinder(divs, v(.5,5,0), v(1,5,0), v(0,0,1), 1.0)
end
})

define_model('nosewheelunit', {
info = {
bounding_radius = 7,
materials={'inside', 'matvar2'}
},
static = function(lod)
set_material('inside', .2,.2,.2,1, 0,0,0, 1, 0,0,0)
end,
dynamic = function(lod)
-- flaps
local v6 = v(1.5, 0, 6)
local v7 = v(1.5, 0, -1)
local v8 = v(0, 0, 6)
local v9 = v(0, 0, -1)
set_material('matvar2', get_arg_material(2))

use_material('inside')
zbias(1, v(0,0,0), v(0,1,0))
-- flap internal
xref_quad(v8, v6, v7, v9)
-- SHould use parameter material(2) here but param materials not done yet
use_material('matvar2')
local flap_ang = 0.5*math.pi*math.clamp(3*get_arg(0),0,1)
local wheel_ang = 0.5*math.pi*math.clamp(1.5*(get_arg(0)-0.34), 0, 1)
local vrot = 1.5*v(-math.cos(flap_ang), math.sin(flap_ang), 0)
xref_quad(v7, v6, v6+vrot, v7+vrot)
xref_quad(v7, v7+vrot, v6+vrot, v6)

call_model('nosewheel', v(0,0,0), v(1,0,0),
v(0,math.sin(wheel_ang),math.cos(wheel_ang)), 1.0)
zbias(0)
end
})

define_model('mainwheel', {
info = {
lod_pixels = {5,50,0},
bounding_radius = 8,
materials = {'leg', 'tyre'}
},
static = function(lod)
local v6 = v(0,0,0)
local v7 = v(0,3,0)
local v8 = v(0,5,0)
-- crossbar
local v13 = v(0, 5, 1.4)
local v14 = v(0, 5, -1.4)
local divs = 4*lod
set_material('leg', .5,.5,.5,1, 1,1,1, 2, 0,0,0)
use_material('leg')
cylinder(divs, v6, v8, v(0,0,1), .4)
cylinder(divs, v7, v8, v(0,0,1), .5)
cylinder(4, v13, v14, v(1,0,0), .5)
set_material('tyre', .3,.3,.3,1, 0,0,0, 1, 0,0,0)
use_material('tyre')
xref_cylinder(divs, v(.5, 5, 1.1), v(1, 5, 1.1), v(0,0,1), 1)
xref_cylinder(divs, v(.5, 5, -1.1), v(1, 5, -1.1), v(0,0,1), 1)
end
})

define_model('mainwheelunit', {
info = {
bounding_radius = 7,
materials={'inside','matvar2'}
},
static = function(lod)
set_material('inside', .2,.2,.2,1, 0,0,0, 1, 0,0,0)
end,
dynamic = function(lod)
-- flaps
local v6 = v(1.5, 0, 6)
local v7 = v(1.5, 0, -1)
local v8 = v(0, 0, 6)
local v9 = v(0, 0, -1)
set_material('matvar2', get_arg_material(2))

use_material('inside')
zbias(1, v(0,0,0), v(0,1,0))
-- flap internal
xref_quad(v8, v6, v7, v9)
-- SHould use parameter material(2) here but param materials not done yet
use_material('matvar2')
local flap_ang = 0.5*math.pi*math.clamp(3*get_arg(0),0,1)
local wheel_ang = 0.5*math.pi*math.clamp(1.5*(get_arg(0)-0.34), 0, 1)
local vrot = 1.5*v(-math.cos(flap_ang), math.sin(flap_ang), 0)
xref_quad(v7, v6, v6+vrot, v7+vrot)
xref_quad(v7, v7+vrot, v6+vrot, v6)

call_model('mainwheel', v(0,0,0), v(1,0,0),
v(0,math.sin(wheel_ang),math.cos(wheel_ang)), 1.0)
zbias(0)
end
})

define_model('delta', {
info = {
scale = 1.00,
bounding_radius = 30,
materials={'courier', 'color1', 'color2', 'grey', 'nazzle'},
tags = { 'ship' },
ship_defs = {
{
'Delta Glider',
{ 7*10^6,-87*10^6,4*10^6,-4*10^6,-4*10^6,4*10^6 },
1*10^7,
{
{ v(0,-0.5,0), v(0,0,-1) },
{ v(0,0,0), v(0,0,1) },
},
{ 70, 1, 2, 3, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 },
70, 35, 35000,
5
}
}
},

static = function(lod)

set_material('courier', .63,.7,.83,1,1.26,1.4,1.66,30)
set_material('color1', .35,.1,.15,1,1,.85,.9,100)
set_material('color2', .15,.1,.35,1,.90,.85,1,100)
set_material('grey', .3,.3,.3,1,.3,.3,.3,10)
set_material('nazzle', .63,.7,.83,1,1.26,1.4,1.66,10)

use_material('courier')

texture('delta.png')

call_model('dg', v(0,0,0), v(1,0,0), v(0,1,0),1)

local vMainThruster = v(0,0,5)
local vForwardThruster1 = v(-0.3,0.6,5.5)
local vForwardThruster2 = v(-0.73,0.1,5.5)
local vForwardThruster3 = v(-0.95,-0.34,5.5)
local vForwardThruster4 = v(0.3,0.6,5.5)
local vForwardThruster5 = v(0.73,0.1,5.5)
local vForwardThruster6 = v(0.95,-0.34,5.5)
local vRetroThruster1 = v(-1.2,0.1,1.5)
local vRetroThruster2 = v(1.2,0.1,1.5)

local v32 = v(-1.0, 1.0, -1.0)
-- 32, right TEMPORARY
local v33 = v(-1.0, -1.0, 1.0)
local v34 = v(1.0, -1.0, -1.0)
-- 34, left TEMPORARY
local v35 = v(1.0, 1.0, 1.0)
local v36 = v(-1.0, 1.0, -1.0)
-- 36, top TEMPORARY
local v37 = v(0.0, 1.0, 1.0)
local v38 = v(0.0, -1.0, -1.0)
-- 38, bottom TEMPORARY
local v39 = v(0.0, -1.0, 1.0)

thruster(vMainThruster, v(0,0,1), 7, true)
thruster(vRetroThruster1, v(-0.2,0.2,-1), 3, true)
thruster(vRetroThruster2, v(0.2,0.2,-1), 3, true)

thruster(vForwardThruster1, v(0,0,1), 2, true)
thruster(vForwardThruster2, v(0,0,1), 2, true)
thruster(vForwardThruster3, v(0,0,1), 2, true)
thruster(vForwardThruster4, v(0,0,1), 2, true)
thruster(vForwardThruster5, v(0,0,1), 2, true)
thruster(vForwardThruster6, v(0,0,1), 2, true)

thruster(v32, v(-1,0,0), 1) --temp
thruster(v33, v(-1,0,0), 1)
thruster(v34, v(1,0,0), 1)
thruster(v35, v(1,0,0), 1)
thruster(v36, v(0,1,0), 1)
thruster(v37, v(0,1,0), 1)
thruster(v38, v(0,-1,0), 1)
thruster(v39, v(0,-1,0), 1) --temp

end,
dynamic = function(lod)
if get_arg(0) ~= 0 then
local v1 = v(0,-1,-2) --TEMPORARY
local v2 = v(-1,-0.75,3) --TEMPORARY
local v3 = v(1,-0.75,3) --TEMPORARY

zbias(1, v1, v(0,-1,0))
call_model('nosewheelunit', v1, v(-1,0,0), v(0,-1,0), 0.3)
call_model('mainwheelunit', v2, v(-1,0,0), v(0,-1,0), 0.3)
call_model('mainwheelunit', v3, v(-1,0,0), v(0,-1,0), 0.3)
zbias(0)
end
end
})

//EDIT

I finally managed to get the landing gear on there, and it loads in the model viewer and the game. However, when I try to take off the game crashes. 🙁

ReplyQuote
Posted : September 7, 2010 18:40
(@potsmoke66)
Noble Member

if you use the standart wheelunits as specified in ships.lua, you don't need to put them in your script.

just call them, they've been loadet previously allways.

a second model with the same name could give problems and i guess the program will take the previously loadet anyways.

else i can't see no wrong,

maybe "dg" can be put to the "main" model, since you don't transform or rotate the mesh dynamically, except you've got plans to do so.

i guess the class 5 hyperdrive is the problem, it's to heavy for the mass of the ship (not enough capacity).

after it runs perfect

Code:
define_model('dg', {
info = {
scale = 9.00,
bounding_radius = 30,
materials={'courier', 'color1', 'color2', 'grey', 'nazzle'},

},

static = function(lod)

set_material('courier', .63,.7,.83,1,1.26,1.4,1.66,30)
set_material('color1', .35,.1,.15,1,1,.85,.9,100)
set_material('color2', .15,.1,.35,1,.90,.85,1,100)
set_material('grey', .3,.3,.3,1,.3,.3,.3,10)
set_material('nazzle', .63,.7,.83,1,1.26,1.4,1.66,10)

use_material('courier')

texture('delta.png')
load_obj('delta2.obj', Matrix.rotate(math.pi,v(0,1,0))*Matrix.translate(v(0,.2,-.3))*Matrix.scale(v(.5,.5,.5))) -- just to fit my test .obj

end
})

define_model('delta', {
info = {
scale = 1.00,
bounding_radius = 30,
materials={'courier', 'color1', 'color2', 'grey', 'nazzle'},
tags = { 'ship' },
ship_defs = {
{
'Delta Glider',
{ 7*10^6,-87*10^6,4*10^6,-4*10^6,-4*10^6,4*10^6 },
1*10^7,
{
{ v(0,-0.5,0), v(0,0,-1) },
{ v(0,0,0), v(0,0,1) },
},
{ 70, 1, 2, 3, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 },
70, 35, 35000,
3
}
}
},

static = function(lod)

set_material('courier', .63,.7,.83,1,1.26,1.4,1.66,30)
set_material('color1', .35,.1,.15,1,1,.85,.9,100)
set_material('color2', .15,.1,.35,1,.90,.85,1,100)
set_material('grey', .3,.3,.3,1,.3,.3,.3,10)
set_material('nazzle', .63,.7,.83,1,1.26,1.4,1.66,10)

use_material('courier')

texture('delta.png')

call_model('dg', v(0,0,0), v(1,0,0), v(0,1,0),1)

local vMainThruster = v(0,0,5)
local vForwardThruster1 = v(-0.3,0.6,5.5)
local vForwardThruster2 = v(-0.73,0.1,5.5)
local vForwardThruster3 = v(-0.95,-0.34,5.5)
local vForwardThruster4 = v(0.3,0.6,5.5)
local vForwardThruster5 = v(0.73,0.1,5.5)
local vForwardThruster6 = v(0.95,-0.34,5.5)
local vRetroThruster1 = v(-1.2,0.1,1.5)
local vRetroThruster2 = v(1.2,0.1,1.5)

local v32 = v(-1.0, 1.0, -1.0)
-- 32, right TEMPORARY
local v33 = v(-1.0, -1.0, 1.0)
local v34 = v(1.0, -1.0, -1.0)
-- 34, left TEMPORARY
local v35 = v(1.0, 1.0, 1.0)
local v36 = v(-1.0, 1.0, -1.0)
-- 36, top TEMPORARY
local v37 = v(0.0, 1.0, 1.0)
local v38 = v(0.0, -1.0, -1.0)
-- 38, bottom TEMPORARY
local v39 = v(0.0, -1.0, 1.0)

thruster(vMainThruster, v(0,0,1), 7, true)
thruster(vRetroThruster1, v(-0.2,0.2,-1), 3, true)
thruster(vRetroThruster2, v(0.2,0.2,-1), 3, true)

thruster(vForwardThruster1, v(0,0,1), 2, true)
thruster(vForwardThruster2, v(0,0,1), 2, true)
thruster(vForwardThruster3, v(0,0,1), 2, true)
thruster(vForwardThruster4, v(0,0,1), 2, true)
thruster(vForwardThruster5, v(0,0,1), 2, true)
thruster(vForwardThruster6, v(0,0,1), 2, true)

thruster(v32, v(-1,0,0), 1) --temp
thruster(v33, v(-1,0,0), 1)
thruster(v34, v(1,0,0), 1)
thruster(v35, v(1,0,0), 1)
thruster(v36, v(0,1,0), 1)
thruster(v37, v(0,1,0), 1)
thruster(v38, v(0,-1,0), 1)
thruster(v39, v(0,-1,0), 1) --temp

end,
dynamic = function(lod)
if get_arg(0) ~= 0 then
local v1 = v(0,-1,-2) --TEMPORARY
local v2 = v(-1,-0.75,3) --TEMPORARY
local v3 = v(1,-0.75,3) --TEMPORARY

zbias(1, v1, v(0,-1,0))
call_model('nosewheelunit', v1, v(-1,0,0), v(0,-1,0), 0.3)
call_model('mainwheelunit', v2, v(-1,0,0), v(0,-1,0), 0.3)
call_model('mainwheelunit', v3, v(-1,0,0), v(0,-1,0), 0.3)
zbias(0)
end
end
})

[attachment=165:2010-09-08_174658.jpg]

if you have planned to write your own uc, name them unique, like "delta_uc" and so on.

if you planned to do one for multiple use, place the script (and ass. files) for it into a folder in "sub_models", so the model will be loadet in advance to the ones from folder "models"

ReplyQuote
Topic starter Posted : September 8, 2010 07:52
(@s2odan)
Noble Member

Thanks dude, I'll try as you suggested.

EDIT//

*crap removed*

As far as I can tell there is something wrong with my model. Its acting very weird in the game.

For example, I can fly the ship using your script(potsmoke) but the ship is backwards, if I turn the ship around in the script then I can no longer fly it in the game. (It crashes). very weird.

ReplyQuote
Posted : September 8, 2010 09:17
(@potsmoke66)
Noble Member

that is truely weird, if you turn the model around it works?

drive class 3?

export options shouldn't matter much,

anyways to make life a bit easier for me i altered the .obj export script for pioneer, so you don't have to set the options each time.

pioneer_obj.py

materials are not needet (.mat), but still supported, you can use the .mat file together with the .obj like in the cobra3 script, texture and material is then allready given.

but if you have a model exported with materials selected you need the .mat together with the .obj.

check both files in wordpad if the materials that are assigned are the same as in the .mat material list, sometimes blender exports them "wrong" (if a object is joined by two meshes, i.e. and the .blend file is not yet saved and reloadet, whicht helps to assign the right materials and textures for "real").

cobra mk3 "old" release (the actual is a bit different)

Code:
define_model('cobra_mk3', {
info = {
lod_pixels = { 50, 100, 200, 0 },
bounding_radius = 100,
materials = {'thrusters', 'text'},
tags = {'ship'},
ship_defs = {
{
'Cobra Mk III',
{ 2*10^7,-2*10^7,1*10^7,-1*10^7,-1*10^7,1*10^7 },
4*10^7,
{
{ v(0,-0.5,0), v(0,0,-1) },
{ v(0,-0.5,0), v(0,0,1) },
},
{ 90, 1, 2, 8, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 },
90, 100, 16000000,
1
}
}
},
static = function(lod)
load_obj('cobra3_redux.obj', Matrix.new(v(45,0,0),v(0,45,0),v(0,0,45)) * Matrix.new(v(-1,0,0),v(0,1,0),v(0,0,-1)))

set_material('thrusters', .30, .30, .30,1, .30, .30, .30, 20)
use_material('thrusters')

local vBackThruster = v(8, 0.7, 14.5) -- last number is how far back down the ship it is
local vFrontThruster = v(3.5, -1.0, -5.0)

xref_thruster(vBackThruster, v(0,0,1), 30, true)
xref_thruster(vFrontThruster, v(0,0,-1), 20, true)

local TopThrust1 = v(-9.0, 1.5, 11.0)
local TopThrust2 = v(9.0, 1.5, 11.0)
local TopThrustForward = v(0.0, 1.5, -11.0)
local BottomThrust1 = v(-9.0, -0.5, 10.0)
local BottomThrust2 = v(9.0, -0.5, 10.0)
local BottomThrustForward = v(0.0, -0.5, -10.0)

thruster(TopThrust1, v(0,1,0), 15)
thruster(TopThrust2, v(0,1,0), 15)
thruster(TopThrustForward, v(0,1,0), 15)
thruster(BottomThrust1, v(0,-1,0), 15)
thruster(BottomThrust2, v(0,-1,0), 15)
thruster(BottomThrustForward, v(0,-1,0), 15)

local LeftBackThruster = v(-18.0, 0.0, 10.0)
local LeftForwardThruster = v(-3.5, 0.0, -10.0)
local RightBackThruster = v(18.0, 0.0, 10.0)
local RightForwardThruster = v(3.5, 0.0, -10.0)

thruster(LeftBackThruster, v(-1,0,0), 15)
thruster(LeftForwardThruster, v(-1,0,0), 15)
thruster(RightBackThruster, v(1,0,0), 15)
thruster(RightForwardThruster, v(1,0,0), 15)
end,
dynamic = function(lod)
if get_arg(0) ~= 0 then

-- lights on wingtips
local lightphase = math.fmod(get_arg(1), 1)
if lightphase > .9 then
billboard('smoke.png', 10, v(1,1,1), { v(-29, 0, 14) })
elseif lightphase > .8 then
billboard('smoke.png', 10, v(1,1,1), { v(29, 0, 14) }) -- middle number is how high vertically on the ship
end

-- wheels
local v73 = v(0.0, -1.0, -5.5)
local v74 = v(-4.5, -4.5, 10.5)
local v75 = v(4.5, -4.5, 10.5)
zbias(1, v73, v(0,-1,0))
-- nose wheel
call_model('nosewheelunit', v73, v(-1,0,0), v(0,-1,0), 1.2)
zbias(1, v74, v(0,-1,0))
-- rear wheels
call_model('nosewheelunit', v74, v(-1,0,0), v(0,-1,0), .64)
call_model('nosewheelunit', v75, v(-1,0,0), v(0,-1,0), .64)
zbias(0)
end
end

})

since that i'm happy i havn't to use the .mat files for pioneer anymore 🙂

the cobras are good examples of a easy .obj use

cobra mk1

ReplyQuote
Topic starter Posted : September 8, 2010 11:51
(@s2odan)
Noble Member

Thanks again for your help.

potsmoke66 wrote:
that is truely weird, if you turn the model around it works?

drive class 3?

Yes, weird eh... I've obviously messed up somewhere 🙂

I thought it might be the model, so I went ahead and remade it and also optimized it so its much smaller as well as removing the materials and associated texture, and also changed the .lua script on your advice but its still crashing when I try to buy the ship.

If I replace my model with any model from the game, then the ship file loads, its only when I use my crappy model that it crashes... 😡

Ive attached the model, if you have some time maybe you could have a look?

edit/

I made this model using the Planemaker for X-plane hehe, then converted it using blender scripts, so maybe that is where the problem lies.... Although if you look at the model file, you will see it looks the same as a 'normal' one. I'm stumped ❓

ReplyQuote
Posted : September 8, 2010 13:07
(@potsmoke66)
Noble Member

i have no exact answer for that

only that when i split the model into 4 parts then 3 are working,

one is left works alone but not with the rest

could be the size of the part which exceeds 1000polys, even when i didn't think that should be a problem

but maybe try to split the model up and see which part or how they work

edit:

it won't, could be simply to oversized, maybe if you split the model and load the parts into separate sub_models.

but it's a bit a riddle

on the other hand i know there are some problems .obj related, that's why i try to script all by now.

somehow the object meshes give trouble in pioneer, but it's not to clear.

ReplyQuote
Topic starter Posted : September 8, 2010 17:25
(@s2odan)
Noble Member

Thanks for looking at the model for me Potsmoker, I will try that what you suggested later on.

Last night I was angry with that model, so I decided to make a totally new one from scratch using blender and smax, with none of the problems that the other model had.

The new model works with almost no problems now...

So I have yet another question, I hope you don't mind...:)

In the pics below you can see in blender the texture is applied correctly, but in the game the texture is mis-alligned and its the same in a model viewer I have (3d model viewer), do you have any idea why that is?

[attachment=169:Untitled.jpg][attachment=170:pioneer-msvc-9 2010-09-09 16-56-04-57.jpg][attachment=171:pioneer-msvc-9 2010-09-09 16-55-45-19.jpg]

ReplyQuote
Posted : September 9, 2010 08:02
Geraldine
(@geraldine)
Famed Member

A good start s20dan! 🙂 Very "Panther" like! Keep at it!

ReplyQuote
Posted : September 9, 2010 08:31
(@s2odan)
Noble Member

Thanks, Geraldine.

Hopefully someone on here knows a bit more than me (shouldnt be hard hehe) and can help with the texture problem 🙂

EDIT//

Been messing around in blender again, heres a render of the ship:[attachment=172:render1.jpg]

Wonder if they could be made to look like that in the game? 🙂

[attachment=173:render2.jpg]

ReplyQuote
Posted : September 9, 2010 08:39
(@s2odan)
Noble Member

Heres another model, supposed to be a boa freighter 🙂

[attachment=174:pioneer-msvc-9 2010-09-09 21-18-35-85.jpg]

ReplyQuote
Posted : September 9, 2010 12:26
(@s2odan)
Noble Member

Thanks, Farcodev 🙂

another pic, but still without textures:

[attachment=177:pioneer-msvc-9 2010-09-09 23-32-11-22.jpg]

ReplyQuote
Posted : September 9, 2010 14:38
(@s2odan)
Noble Member

Finally.. Textures...

Turns out all my texture co-ordinates were being saved upside down, so I just flipped the images over vertically and it worked 🙂

[attachment=181:pioneer-msvc-9 2010-09-10 03-14-47-03.jpg]

[attachment=182:pioneer-msvc-9 2010-09-10 03-28-53-27.jpg]

[attachment=183:pioneer-msvc-9 2010-09-10 03-21-48-15.jpg]

ReplyQuote
Posted : September 9, 2010 18:37
(@potsmoke66)
Noble Member

yes, textures have to be flipped vertically, i guess mainly because blender is lefthanded and pioneer is righthanded.

the "smear" that is on the texture of the panther happens when you break (island) a texture of a smoothened surface.

the vertices of the model are then united and you pull the vectors of the texture over the image, i hate that, even if it's logical, other programs aren't that sensible to that.

i tried some to evade that (seams, pin) but it only works for blender (of course), the .obj file don't preserves such information (very basic type of mesh, vectors, normals, uv, poly's and smoothing off or on, that's all).

solution, split the eges where texture is cut (sad shit), or try to use a seamless texture mapping (hard to achieve, maybe texture it in blender and create a "seamless" rendered texture from it? somwhere of course the tex have to be split off, but if it's on a hard edge, no problem).

so texture mapping top side should be seamless to have a correct reproduction in the game (if it's a soft edge), worst is when the texture is tiled and turned 90° what is a common way to tile the space of the map (so done for my adder, again even if i know the fact since the first .obj model, "XWA-Preybird", i did for Pioneer).

maybe the use of the .mat file could be a help since the mesh's texture info is stored there and the related material is stored in the .obj file at proper position between the poly's, so it's possible then to have two materials (and textures) in one object, when they are stored correctly in the .obj file, it could work, but .mat must then be used together with the .obj file and texture doesn't have to be applied in the script then.

i guess then it should be possible to "island" a texture in a separate map and the uv vectors can't "smear" over the map, because there is no.

i haven't tried that yet, maybe it's worth to findout, because i really don't like to split a edge when you feel it should be soft.

great ship models, i like the "leather poach", 😆

no really, the boa looks very agressive, cool 😎

ReplyQuote
Topic starter Posted : September 9, 2010 19:18
(@s2odan)
Noble Member

Thanks 🙂

Yeah the smearing and texture seams are very annoying

Its quite bad on the boa here:

[attachment=184:modelviewer-msvc-9 2010-09-10 05-07-45-95.jpg]

[attachment=185:modelviewer-msvc-9 2010-09-10 05-07-36-46.jpg]

The white line on the bottom and the lines on the back seem to come from nowhere, as there is no white on the texture...

I'll try and fix it tomorrow, but bed for now 🙂

ReplyQuote
Posted : September 9, 2010 20:27
(@potsmoke66)
Noble Member

i will check my adder, and see if i can workaround that using the .mat file, but not before noon 😉

if i didn't succeed you still can split the edges where the texture seams are

or vice versa, make texture seams where the splitted edges are.

...no, i can't find a pic of the adder with smeared textures, sad i wanted to show the difference after i split the relevant edges, it's not as hard to look at as i thought before i did it.

ReplyQuote
Topic starter Posted : September 9, 2010 20:56
(@potsmoke66)
Noble Member

no, it was no success

due to whatever, the vectors of a smoothened body get pulled over the map even when you split up the texture and use the .mat file to assign the texture to the mesh (not object).

[attachment=193:2010-09-11_114911.jpg]

but it was worth a try, now i know that there is only one way to evade the "smear", splitted vertices (or edges).

else the joined vertice get's allways pulled over the whole map, even when the texture is split up for each meshs uv.

anyway this method didn't allows to use different sized textures for the lod, these you can only assign in the script.

doesn't mind, it was just a test to see if that would work, it hasn't.

but that means mapping and splitting of edges has to be planned carefully. when you respect that from start on it's easier neither to rework a fully smoothened body.

i remember the troubles uncle bobs lanner gave me, many parts i had to split from the original object to evade that,

he just pulled the uv enywhere sometimes to get a certain part remapped. i guess .x and other formats are less sensible to that rather .obj. might be they use separate vectors for the uv, while .obj uses the uv vectors linked to the vertices.

so that when a vertice is unified it will have unified vectors for uv to.

i'm not shure if there is a way to work around that, but i guess there should be a way, because the uv vectors are stored separately in the .obj file, only thing is manage it to get them splitted when a vertice is unified. but i can't say if it's possible at all, maybe they are really linked to the vertices.

.x files as example, store a extra vertice list, which i guess is exactly for this, to separate (or add) uv vectors from (to) vertice vectors. or separate normals from vertices so a vertice can be split but normals stay unified, but in the end the result is the same.

that brings up a idea, i know you can't separate normals from vertices in blender, but other programs like my old z-modeler they do, you can unify (split, rotate, strech) the normals no matter if the vertice is unified or split.

in the very beginning i found blenders way to manage the normals annoying and there is a disadvantege to that, you simply can't separate the normals from the vertices.

sadly the free version (1.7) of z-modeler has no .obj export, else i would give that a try and i'm not shure if the information get's lost in a other file format. but one thing i'm shure i can do with the normals what i want in z-modeler if i import a i.e. exported .3ds mesh then to blender everything except uv and unified (or split) vertices is lost, normals tuning like in z is not possible. further i think not all file formats support this.

but i remember also that tomm once suggested that he could use a other model format, mainly this was because kenny (axeman3d) asked for it, because he couldn't export .obj from lightwave, without loosing uv.

so this is still open, even if we (i) had to rework then all old models.

another way i guess is like i suggested to map the mesh as one and where edges are unified to smooth uv will have to be one strip, usually this is not to manage, but i guess with a remapping and rebuild of the texture from a rendered body this should be possible (the texture will then be streched to the angle when "flattened" to uv). but i have to say rendering and remap from a render is not the thing i know much about.

i havn't tried that never and would cost me a lot of investigations to find out how, i remember i liked to remap once a existing model using this feature of blender, but i didn't get to far with it.

ReplyQuote
Topic starter Posted : September 11, 2010 02:28
(@s2odan)
Noble Member

Ive been working on my panther model and trying to add different colours to the ship, so the colour of the ship is always differnt with every new ship.

However my code is causing a crash, could you please have a look?

Code:
define_model('panther', {
info = {
scale = 1.0,
bounding_radius = 30, --??
materials={'red', 'blue', 'green', 'dblue', 'lblue', 'yellow', 'text1', 'text2', 'dred', 'light', 'dark'},

tags = { 'ship' },
ship_defs = {
{
'Panther',
{ 7*10^6,-87*10^6,4*10^6,-4*10^6,-4*10^6,4*10^6 },
1*10^7,
{
{ v(0,-0.5,0), v(0,0,-1) },
{ v(0,0,0), v(0,0,1) },
},
{ 930, 1, 2, 3, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 },
930, 460, 350000,
6
}
}
},

static = function(lod)

set_material('red', .83,.2,.2,1,1.26,1.4,1.66,30)
set_material('dred', .43,.1,.1,1,1.26,1.4,1.66,30)
set_material('green', .1,.76,.76,1,1.26,1.4,1.66,30)
set_material('yellow', .1,.73,.1,1,1.26,1.4,1.66,30)
set_material('dblue', .1,.1,.45,1,1.26,1.4,1.66,30)
set_material('blue', .1,.1,.63,1,1.26,1.4,1.66,30)
set_material('lblue', .2,.2,.83,1,1.26,1.4,1.66,30)
set_material('light', .9,.9,.9,1,1.26,1.4,1.66,30)
set_material('dark', .1,.1,.1,1,1.26,1.4,1.66,30)

end,

dynamic = function(lod)

selector2()
if select2 < 10 then
use_material('green')
call_model('pant', v(0,0,0), v(1,0,0), v(0,1,0),1)
else
if select2 < 20 then
use_material('blue')
call_model('pant', v(0,0,0), v(1,0,0), v(0,1,0),1)
else
if select2 < 30 then
use_material('light')
call_model('pant', v(0,0,0), v(1,0,0), v(0,1,0),1)
else
if select2 < 40 then
use_material('red')
call_model('pant', v(0,0,0), v(1,0,0), v(0,1,0),1)
else
if select2 < 50 then
use_material('dblue')
call_model('pant', v(0,0,0), v(1,0,0), v(0,1,0),1)
else
if select2 < 60 then
use_material('dred')
call_model('pant', v(0,0,0), v(1,0,0), v(0,1,0),1)
else
if select2 < 70 then
use_material('yellow')
call_model('pant', v(0,0,0), v(1,0,0), v(0,1,0),1)
else
if select2 < 80 then
use_material('dark')
call_model('pant', v(0,0,0), v(1,0,0), v(0,1,0),1)
else
if select2 < 90 then
use_material('lblue')
call_model('pant', v(0,0,0), v(1,0,0), v(0,1,0),1)
else
if select2 > 90 then
use_material('light')
call_model('pant', v(0,0,0), v(1,0,0), v(0,1,0),1)
end
end
end
end
end
end
end
end
end
end
end

})

EDIT//

Nevermind I managed to get it working.

[attachment=196:pioneer-msvc-9 2010-09-14 03-25-46-18.jpg]

It works but the random colours are always very dark.

ReplyQuote
Posted : September 13, 2010 17:07
Page 3 / 10