modeling for pioneer

Pioneer is an open-ended space adventure game. Explore the galaxy, make your fortune trading between systems, or work for the various factions fighting for power, freedom or self-determination.
Homepage: http://pioneerspacesim.net/
IRC: http://pioneerspacesim.net/irc
Downloads: https://pioneerspacesim.net/page/download/
Potsmoke66
Private
Posts: 1815
Joined: Sun Nov 27, 2016 2:43 pm

RE: modeling for pioneer

Post by Potsmoke66 »

how to place decals randomly on a shipthe idea:you would like to customize your ships with decals, little signs that make them more unique, likewise on WW2 Bombers ;) solution:
Code:
-- small sub-model for use in all models to place (cutout) decals on them, texture can have a alpha channel for a cutout decal but it's not a mustdefine_model('decal', {info = {lod_pixels = {20, 50, 100, 0},bounding_radius = 1,materials = {'decal'}},static = function(lod)end,dynamic = function(lod)math.randomseed(tonumber(string.sub((string.gsub(reg,"%W", 1)),5,7),36)) --[[ generates number from ship registration# for random seed, any string is converted to a number, with replacement of non-alphanumerical by 1, because you might like to "hack" your savegame to give your ship a name instead of a reg#, e.g. "KILLER!" or " LUCKY-7", then decal selection still works! further modelviewers given reg# "IR-L33T" still works with that to ;) --]] local dec = math.random() -- randomizes 0 to 1, uses seed for a uniqe fractal number in between 0 to 1 (inclusive), identical numbers produces the same random result set_material('decal', 1,1,1, 0.9, .7,.7,.7,10) -- creates semi-transparent material to cut out alpha channel, has to be 0use_material('decal')if dec < .15 thentexture('models/decals/decal_a.png', v(0,0,0), v(0,0,-1), v(0,-1,0)) -- calls the texture for the decal,elseif dec < .29 thentexture('models/decals/decal_b.png', v(0,0,0), v(0,0,-1), v(0,-1,0)) -- if sequence could be expandet to 10000!(limited by reg# length) different decals, but max. 20 will be ok ;) else if dec < .43 thentexture('models/decals/decal_c.png', v(0,0,0), v(0,0,-1), v(0,-1,0)) -- when adding a additional one, divide 1 through no. of total decals, add one to result in hundreth unitselse if dec < .58 then texture('models/decals/decal_d.png', v(0,0,0), v(0,0,-1), v(0,-1,0)) -- feel free to exchange the existing ones with your own style else if dec < .72 then texture('models/decals/decal_e.png', v(0,0,0), v(0,0,-1), v(0,-1,0)) -- accepts any quadratical sized texture, recommendet are 100x100 - 200x200 else if dec < .86 then texture('models/decals/decal_f.png', v(0,0,0), v(0,0,-1), v(0,-1,0)) else texture('models/decals/decal_g.png', v(0,0,0), v(0,0,-1), v(0,-1,0)) end endend endendendquad(v(0,0,0), v(0,1,0), v(0,1,1), v(0,0,1)) -- creates a quadratic shape 1m x 1m for the decalend})
create a new folder into "....data\models\" named decals put the above script named decals.lua and your textures for the decals into the new folder, of course they have to be named like it's given in the script (decal_a to decal_g). you can expand the script if you like, to have more variations. recommendet texture size is 100x100 - 200x200 pixels regular quadratic to make it work, with a optional alpha channel to cutout the decals. of course this works only on new ships models, which includes a call for the decal model, it will look like this:
Code:
if lod > 1 thencall_model('decal', v(3.56,0.6,-5), v(1,0,0), v(-0.235,1,0), 1.2) call_model('decal', v(-3.56,0.6,-4), v(-1,0,0), v(0.235,1,0), 1.2) end
the example code is from my IP Shuttle for a left and rightside placement (i guess you have recognized them allready)you can download my decals folder from here (the shuttle who uses them as a first example isn't finished yet, i'm still not satisfied :roll: ): decals.zip
Potsmoke66
Private
Posts: 1815
Joined: Sun Nov 27, 2016 2:43 pm

RE: modeling for pioneer

Post by Potsmoke66 »

just some screenshots of my work in progressit's allmost finished but it fails on final quality testing :roll: (it's not playable :cry: )[attachment=127:ScreenShot00002.jpg][attachment=128:ScreenShot00004.jpg]
User avatar
Geraldine
Private
Posts: 3454
Joined: Fri Nov 25, 2016 9:12 pm

RE: modeling for pioneer

Post by Geraldine »

I always liked the Imperial Trader, it always reminded me of the Liberator from Blake's 7. Here is a render I found and nice work Potsmoke on the landing gear! :)
Potsmoke66
Private
Posts: 1815
Joined: Sun Nov 27, 2016 2:43 pm

RE: modeling for pioneer

Post by Potsmoke66 »

i've layed my hands on uncle bob's Lanner, cause he said it would be fine if i would release it for pioneer (coolhands viper is still waiting, the under carriage he used gives me a real headake, to animate).of course you will have variations in skin colors. some previews;[attachment=132:2010-07-29_220147.jpg] sadly there is only one blue color to represent the colorvariable in pioneers modelviewer. ;) landing gears, thruster positions and pos.lights has to be finished but apart from, that soon ready.
RedRiver
Private
Posts: 32
Joined: Thu Jul 01, 2010 12:40 pm

RE: modeling for pioneer

Post by RedRiver »

looking good... what are the specs?
Potsmoke66
Private
Posts: 1815
Joined: Sun Nov 27, 2016 2:43 pm

RE: modeling for pioneer

Post by Potsmoke66 »

it will be like the original lannerLannerHull Mass 53tMass (full) 245tInternal Cap 198tRetro Thr. Acc 4gMain Thr. Acc 8gGun Mounts 2Missile Pylons 2Scoop Mount yes(Crew 3, no crew in pioneer so far)284ki guess acceleration should be upgraded, even if it's a very good trading ship i guess.but the mesh is giving me some new unknown problems. while i was allready in a stage to test the ship i found out that it slows the framerate of pioneer completely down.tonight i was after this problem to find out why and found no good answer only that one of the meshes is responsible for that, but i have no idea why, i removed any of color or skin variations, i removed allmost everything, only static stuff is left, still it slows the framerate down to 10/s when i load a specific mesh (.obj) of the ship into the model.strangewisely only one specific, the other parts i used, work well together. :o now i'm a bit helpless i can say and really like to give that project up or lay on ice until i find a solution.maybe a complete rework is the only solution for it, but i THOUGHT it's going to be a quick conversion of a existing model, now it seems to get much more complicated as expected.it's only one specific mesh, that's what gives me the headake, it couldn't be polycount, my courier has as double of polys wether than uncle bobs lanner model, skins i also took only the small ones for lower lod, no effect.maybe it's the mapping, but on the other hand skin size and triple use of it, what i thought at first would be the reason, brought me to the useless idea to split the skin for each used material, it didn't changed a thing. there is something "secret" within the mesh of the lanner which makes it extremely hard to be calculated in pioneer.maybe it's the mesh itself, i discovered that a lot of polys did stand loose, they are not like a common mesh, i think one thing i will try i haven't weld all vertices of the mesh so it becomes a "real" mesh. or i can do a radiosity "copy" of it and generate a new one, maybe that could help.maybe we will see this ship never in pioneer, because i really don't know where to search for by now. :( but others have to be made, maybe i prefere one of my own models again next, or do a pure scripted one again, like the ip shuttle, that will be the safest way to succeed.edit: forget all the above argueing and whinings :mrgreen:
Potsmoke66
Private
Posts: 1815
Joined: Sun Nov 27, 2016 2:43 pm

RE: modeling for pioneer

Post by Potsmoke66 »

hint; for all future pioneer models and modelers- you need to to have a collision mesh if you have a model constructed from .obj meshes (for spaceships at least).- this collision mesh has to be at lod == 1, which should be then 1 pixel. this mesh does not need to have any material or skin, because you won't see it then.- all other meshes (.obj) have to be loadet at lod > 1.- alternatively, you can of course use a lowpoly model as "real" model for lower (lowest) lod and set this then to a more complying lod, like 20 or 50 pixels limited with a lod < 2 command i.e., but that needs additional work and further you can use only one skin on it, variations depend on a submodel again which is not used for collision detection. - hint place some not visible quads under your wheels (they will be submodels to mostly, because of animation), this makes shure the ship will land on the right level and "dives" not under the surface when landet. you can place it allready a bit over the ground, because this you will not recognize when watching it. again, i stumbled over that, and thought it would be enough to have a collision mesh for the meshes that have not been directly loadet int the main model script. this is somewhat true.....but any mesh loadet at lod 1 will act as collision mesh. this slows pioneer extremely down if it's a somewhat bigger mesh (>1000 polys) and with any additional mesh it slows down more.so it's best to load all .obj at lod bigger than 1 and to create a extreme lowpoly mesh as a collision mesh, this could be scripted or a .obj file. then everything works out fine and framerate does not get touched, (almost) doesn't matter how big it is.8-)i really like that you have manually to land in pioneer, instead to allways do it by autopilot. i really like to watch the ships from the outside camara view and get slowly used to use my ships this way when landing. in FE2 this you won't have to do so often. so you have all this nice models in FFED3D, but you never look at them, because mostly you watch from inside the ship, even landing which is less skillful in FE2.
Potsmoke66
Private
Posts: 1815
Joined: Sun Nov 27, 2016 2:43 pm

RE: modeling for pioneer

Post by Potsmoke66 »

btw, maybe some had that allready experienced the lanners gun is setup one sidet, sorry a bug left from a experiment i made.or even not, maybe gun use will be fixed once, then it will make some sense, but i could update it. the idea was to have front and rear guns working in the same direction, but due to the "laser bug" in pioneer, both use the same vectors, no matter what you enter for the second (rear) gun, so it never fires to back, you may have noticed that to.or i post the snippet of the script who did that change right to a mid position,then it''s your opinion how you like it, one sided right, or centered.
Code:
define_model('lanner_ub', {info = {scale = 0.8, -- scaled down, because the ship is much to large in FFE, imholod_pixels = {1, 30, 100, 0},bounding_radius = 50,materials = {'default', 'matte', 'glow', 'e_glow', 'win'},tags = {'ship'},ship_defs = {{'Lanner', { 1.5*10^7,-3*10^7,1*10^7,-1*10^7,-1*10^7,1*10^7 },4*10^7,{{v(0,-1.9,-38), v(0,0,-1)}, -- centered front gun mounting{v(0,1,39), v(0,0,1)}, -- centerd rear gun, not working yet}, { 198, 1, 2, 4, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 },198, 53, 1, --28400000, -- change price to full or buy one for a cent ;) 3}}},
paste that exactly over the original part of the script (line 503 to 524), voila.double dash marks a comment or leftout option (price i.e.).of course if you buy one for only a cent it has no resale value to, even when you change the price for a new ship afterwards to full!if you like to fiddle around with the ship specs, feel free. use pioneers wiki as guidelineDefining_ship_types_for_models
Potsmoke66
Private
Posts: 1815
Joined: Sun Nov 27, 2016 2:43 pm

RE: modeling for pioneer

Post by Potsmoke66 »

again i have to pester you with that....no it's just a small FFE scale difference from what elite-games.ru stated to what i discovered after all my work with the models from it.assuming that the 50m mark, marks the height of the dock of a station, which is correct compared to building size and so on. i found out if i use the scale i used until now, based on elite-games.ru scaler etalon, the entry is not 50m then, it's about 55 - 60 meters then.personally i allways used that to compare to all the rest of FFED3D, but as i started to workout the models for pioneer, i get suspected by the varying scales of the original vectors in the code. so i took the "wheel" station to blender and layed on my usual magnification of 8.7 (1:1.15) to it. i need a exact scale to figure out vector spacing used in the code. but then the height of the entry is over 50meters. oops, so i came to a new value which is then 1:1.0713 when respecting the 50 meters height, the width will be then around 94 only and not 100 meters.like i said only a small difference but it's annoying me, especially when i had to find the right scale of the original vectors of the models. i.e. the eagle has a length of so and so ~15 meter, but in the code it has a length of 65 integers, but the ip shuttle has a length of ~10.5 meters, but has a length of 150 integers. you see models in the code are scaled different and i have to know the exact size of the ships to reproduce them in a script for pioneer. that's why i need a exact scale to keep the failure as low as possible. only then i can exactly determine how i have to scale down the vectors or the final model i scripted from the code.the shuttle is allready wrong sized and has a length of 15 meters, because i simply assumed a scale of 1:10 for it, therefore it's sized up in capacity as well, so it didn't matters much, i guess.but for other models i will keep the original size, so i must know exactly how to scale FFED3D export to fit to meters, else i have found no useful rule for it. the scale which is codet is not very helpful and none fits to 150 = 10.5m 65 = 15m.further shiphulls used double in FFE have the same size so this is not proper a courier should be smaller as a trader imho,a lanner reasonably smaller as a lanner2 (well the lanners size gave me real trouble when i worked on it 53t shiphull and a supersized model?) the fault must be in the way ffed3d exports the mesh of such double used model, i would swear they have different sizes in ffe.on the other hand there must be a way to find out the scale by the code, i simply haven't found it yet.
Marcel
Private
Posts: 1188
Joined: Tue Dec 06, 2016 6:45 pm

RE: modeling for pioneer

Post by Marcel »

Potsmoke, thanks for the link to the Pioneer Wiki, hopefully it'll give me the info I need to contribute something to this project. You are so prolific and your work is of such high quality that I'm in awe of you. I'll be happy if I can contribute one object to the game, but I'm afraid you'll finish it all before I can figure out how to do it!
Potsmoke66
Private
Posts: 1815
Joined: Sun Nov 27, 2016 2:43 pm

RE: modeling for pioneer

Post by Potsmoke66 »

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 :lol:
Marcel
Private
Posts: 1188
Joined: Tue Dec 06, 2016 6:45 pm

RE: modeling for pioneer

Post by Marcel »

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. :D
Potsmoke66
Private
Posts: 1815
Joined: Sun Nov 27, 2016 2:43 pm

RE: modeling for pioneer

Post by Potsmoke66 »

some commands you won't find in the wiki (mainly "matrix.xxx" for loadet .obj meshes and some other parts);addendum: LUA commands for modelssphere commands:sphere(number of subdivisions, optional transform matrix)sphere is a sub-divided icosahedron. number of divisions can be from 0to 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 spheresphere_slice(20, 20, 0, 0.5*3.141) orsphere_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 deformationwill draw a half spheresphere_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 itMatrix 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.5Matrix.translate(v(10,0,0))Moves vector x by 10 to right sideMatrix.rotate(0.5*math.pi,v(0,1,0))Rotates 90° along vector yMatrix.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/partuse multiple instances of Matrix.xxx for a mesh in the following wayload_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 wikihttp://pioneerspacesim.net/wiki/index.php?title=Main_Pagecall 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 upwardscreate 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 desiredrotation 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, orlocal dings = math.pi*(get_arg(1))for a free game time dependant animation (e.g. a clock), orlocal 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 / 12call_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 systemyou 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 examplequadric_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 visibleor paste to a separate .lua and specify as ’any model’cubic_bezier_tri:also from ’test’ disabled as a comment, uncomment it to make it visibleor paste to a separate .lua and specify as ’any model’quadric_bezier_tri:another example from ’test’ 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 cubeglobal arguments used for models:get_arg_string(), by now only "0" for the ships registration no.get_arg(0), the UC release counterget_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 pageshttp://pgl.yoyo.org/luai/i/_http://luanet.net/luaa few helpful ones:math.pi, generates the number pimath.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 fractalsos.clock(), returns operating systems clock count from call on
tomm
Private
Posts: 129
Joined: Sat Mar 06, 2010 1:06 pm

RE: modeling for pioneer

Post by tomm »


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.
Potsmoke66
Private
Posts: 1815
Joined: Sun Nov 27, 2016 2:43 pm

RE: modeling for pioneer

Post by Potsmoke66 »

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 instancefirst 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...
Potsmoke66
Private
Posts: 1815
Joined: Sun Nov 27, 2016 2:43 pm

RE: modeling for pioneer

Post by Potsmoke66 »

something i forgot to tellit 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).
s2odan
Private
Posts: 1212
Joined: Sun Mar 22, 2009 9:50 pm

RE: modeling for pioneer

Post by s2odan »

I finally got round to porting one of my models over to pioneer heres some pics: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) --TEMPORARYlocal v32 = v(-9.0, 5.0, -30.0)-- 32, right TEMPORARYlocal v33 = v(-12.0, -5.0, 30.0)local v34 = v(12.0, -5.0, -30.0)-- 34, left TEMPORARYlocal v35 = v(9.0, 5.0, 30.0)local v36 = v(0.0, 12.0, -30.0)-- 36, top TEMPORARYlocal v37 = v(0.0, 12.0, 30.0)local v38 = v(0.0, -12.0, -30.0)-- 38, bottom TEMPORARYlocal 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) --tempthruster(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) --tempend})
I know I don't have landing gear yet, could that be what is causing the crash? Does anyone have any ideas? Cheers.
Marcel
Private
Posts: 1188
Joined: Tue Dec 06, 2016 6:45 pm

RE: modeling for pioneer

Post by Marcel »

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!
s2odan
Private
Posts: 1212
Joined: Sun Mar 22, 2009 9:50 pm

RE: modeling for pioneer

Post by s2odan »

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*4cylinder(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)-- flapslocal 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 internalxref_quad(v8, v6, v7, v9)-- SHould use parameter material(2) here but param materials not done yetuse_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)-- crossbarlocal v13 = v(0, 5, 1.4)local v14 = v(0, 5, -1.4)local divs = 4*lodset_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)-- flapslocal 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 internalxref_quad(v8, v6, v7, v9)-- SHould use parameter material(2) here but param materials not done yetuse_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 TEMPORARYlocal v33 = v(-1.0, -1.0, 1.0)local v34 = v(1.0, -1.0, -1.0)-- 34, left TEMPORARYlocal v35 = v(1.0, 1.0, 1.0)local v36 = v(-1.0, 1.0, -1.0)-- 36, top TEMPORARYlocal v37 = v(0.0, 1.0, 1.0)local v38 = v(0.0, -1.0, -1.0)-- 38, bottom TEMPORARYlocal 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) --tempthruster(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) --tempend,dynamic = function(lod)if get_arg(0) ~= 0 thenlocal v1 = v(0,-1,-2) --TEMPORARYlocal v2 = v(-1,-0.75,3) --TEMPORARYlocal v3 = v(1,-0.75,3) --TEMPORARYzbias(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)endend})
//EDITI 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. :(
Potsmoke66
Private
Posts: 1815
Joined: Sun Nov 27, 2016 2:43 pm

RE: modeling for pioneer

Post by Potsmoke66 »

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"
Post Reply

Return to “Pioneer”