Attaching *models* onto *units* - Page 3

Attaching *models* onto *units*

Discuss Lua based Spring scripts (LuaUI widgets, mission scripts, gaia scripts, mod-rules scripts, scripted keybindings, etc...)

Moderator: Moderators

User avatar
Pressure Line
Posts: 2283
Joined: 21 May 2007, 02:09

Re: Attaching *models* onto *units*

Post by Pressure Line »

edit: with some help from jK i have it loading (and rendering!) the changed geometry. now for textures
User avatar
Pressure Line
Posts: 2283
Joined: 21 May 2007, 02:09

Re: Attaching *models* onto *units*

Post by Pressure Line »

99% complete. only problem is that shadows are not casting properly (recieving fine), Spring seems to be reading the alpha channel on the textures as actually transparent. not 100% sure how to fix.

Image

woohoo!
Attachments
screen00000.jpg
(356.9 KiB) Downloaded 2 times
User avatar
smoth
Posts: 22309
Joined: 13 Jan 2005, 00:46

Re: Attaching *models* onto *units*

Post by smoth »

perhaps JK may be able to give insight on it?
User avatar
Pressure Line
Posts: 2283
Joined: 21 May 2007, 02:09

Re: Attaching *models* onto *units*

Post by Pressure Line »

Shadows fixed, but another problem has popped up to do with the displaylists, gonna quickly swing off onto a parallel track, try and get something releasable before I fall into a black hole of buggy, poorly written code :D
User avatar
Pressure Line
Posts: 2283
Joined: 21 May 2007, 02:09

Re: Attaching *models* onto *units*

Post by Pressure Line »

Fixed the screwyness, but no show/hide :(

So here it is :)
Read me before downloading wrote:1)to activate the gadget for a unit, it will need a customparam in the unitdef "unitdraw" it can be any non-nil value

2)the names of the pieces to be drawn onto other models MUST be unique, be creative!

3)the pieces to be loaded need to be in the s3o of a valid unitdef, this means script and unitdef.lua (they can be rubbish values, but they have to be there)

4)the best (imo) way to organize the pieces is to group them into 'library' units, this will save on texture memory use, aswell as being much cleaner
Attachments
unit_draw.7z
(2.06 KiB) Downloaded 28 times
User avatar
Pressure Line
Posts: 2283
Joined: 21 May 2007, 02:09

Re: Attaching *models* onto *units*

Post by Pressure Line »

new version, should be 100% functional.
Attachments
UnitDraw.7z
(2.07 KiB) Downloaded 33 times
User avatar
knorke
Posts: 7971
Joined: 22 Feb 2006, 01:02

Re: Attaching *models* onto *units*

Post by knorke »

acuelly is 99%
User avatar
Pressure Line
Posts: 2283
Joined: 21 May 2007, 02:09

Re: Attaching *models* onto *units*

Post by Pressure Line »

knorke wrote:acuelly is 99%
rubbish :wink: it's some other funky lua you got running probably.

testmod works fine.
User avatar
knorke
Posts: 7971
Joined: 22 Feb 2006, 01:02

Re: Attaching *models* onto *units*

Post by knorke »

can you upload the tutorialgame with the draw stuff inserted?
to test if it is a mod or computer thing.
User avatar
Pressure Line
Posts: 2283
Joined: 21 May 2007, 02:09

Re: Attaching *models* onto *units*

Post by Pressure Line »

Download this and it should work out of the box.
User avatar
Pressure Line
Posts: 2283
Joined: 21 May 2007, 02:09

Re: Attaching *models* onto *units*

Post by Pressure Line »

getting some of the weird errors you reported last night knorke, no idea wtf is causing them :|
User avatar
knorke
Posts: 7971
Joined: 22 Feb 2006, 01:02

Re: Attaching *models* onto *units*

Post by knorke »

Pressure Line wrote:Download this and it should work out of the box.
this works.

just stupid guess, but could the problems be because not all textures have the same dimensions?
User avatar
Pressure Line
Posts: 2283
Joined: 21 May 2007, 02:09

Re: Attaching *models* onto *units*

Post by Pressure Line »

nope, that aint it.

new screens :D i think i have all the bugs pretty much ironed out.

Image
scoutcar on the right has wheels taken from something i found on my HDD, has a 512*256 texture! The brown tank is trying on the Angletank's turret for size.

Image
The 'Trifighter' with the gun barrel from my 'Angletank' model
Attachments
screen00002.jpg
(281.86 KiB) Downloaded 2 times
screen00001.jpg
(348.57 KiB) Downloaded 2 times
User avatar
smoth
Posts: 22309
Joined: 13 Jan 2005, 00:46

Re: Attaching *models* onto *units*

Post by smoth »

Is this just the texture attachment or actual piece attachment?
User avatar
Pressure Line
Posts: 2283
Joined: 21 May 2007, 02:09

Re: Attaching *models* onto *units*

Post by Pressure Line »

You can keep your toys in the cot smoth.

The gadget grabs the geometry of a piece and the texture from a unit, and replaces the geometry of the piece(s) defined in the gadget config.

Still got work to do on the loading side (currently all the dLists are loaded at game-start which is quite seriously non-ideal) as well as setting up a debug mode and appropriate messages and a few other minor things.
User avatar
smoth
Posts: 22309
Joined: 13 Jan 2005, 00:46

Re: Attaching *models* onto *units*

Post by smoth »

still it is a lot further than you were thinking you'd get to a few days ago! Keep up the good work man, this is pretty cool.
User avatar
Pressure Line
Posts: 2283
Joined: 21 May 2007, 02:09

Re: Attaching *models* onto *units*

Post by Pressure Line »

It's currently totally functional, will need to test with custom texture-based shaders (normalmaps) but the "x-ray highlight" widget works fine. I'm thinking I will need to manually add in support for normal maps, but it's hard to test as I have no normal-mapped units.
User avatar
Pressure Line
Posts: 2283
Joined: 21 May 2007, 02:09

Re: Attaching *models* onto *units*

Post by Pressure Line »

I still feel the gadget needs a less 'general' name. Currently called "unit_draw.lua" not sure what else fits though :?
User avatar
smoth
Posts: 22309
Joined: 13 Jan 2005, 00:46

Re: Attaching *models* onto *units*

Post by smoth »

Pressure Line wrote:It's currently totally functional, will need to test with custom texture-based shaders (normalmaps) but the "x-ray highlight" widget works fine. I'm thinking I will need to manually add in support for normal maps, but it's hard to test as I have no normal-mapped units.
s44 has a few.
User avatar
Pressure Line
Posts: 2283
Joined: 21 May 2007, 02:09

Re: Attaching *models* onto *units*

Post by Pressure Line »

woo!

on-demand loading of the displaylists is here! also added in a debug mode switch (only settable by changing a boolean in the gadget, i will consider making a "/changepiece debug" switch if its *really* wanted) and commented some of the code.

will clean up the mod file and release for testage later
Post Reply

Return to “Lua Scripts”