View topic - Attaching *models* onto *units*



All times are UTC + 1 hour


Post new topic Reply to topic  [ 61 posts ]  Go to page Previous  1, 2, 3, 4  Next
Author Message
PostPosted: 17 Jun 2012, 13:29 
Content Developer
User avatar

Joined: 13 Jan 2005, 00:46
Location: ModalitÃ
For what I am doing, lua rendering it the way you are doing is not useful. This thread is about a specific approach.


Top
 Offline Profile  
 
PostPosted: 17 Jun 2012, 20:28 
Battletech Developer
User avatar

Joined: 21 May 2007, 01:09
Location: New Zealand
smoth wrote:
Here is what I am trying to do:
I have a unit, this unit has an empty node which I want to attach a model to.


done.

smoth wrote:
I want the model to work as though it was a regular piece on the unit.


done*.

*you can do everything except show/hide or explode the drawn piece. all translations and rotations that affect the node the model is attached to are preserved.

smoth wrote:
For what I am doing, lua rendering it the way you are doing is not useful. This thread is about a specific approach.


I'm not sure I understand. v4 does (almost) everything you requested in your first post (inasmuch as the external model needs to act as if it is part of the original model) The fact that I am attaching the tank model onto the end of the barrel is solely due to the fact that I did the coding on my netbook, which doesn't have the tools installed for me to make a proper test model and texture it.


Top
 Offline Profile  
 
PostPosted: 17 Jun 2012, 21:18 
Content Developer
User avatar

Joined: 13 Jan 2005, 00:46
Location: ModalitÃ
Perhaps jk can explain it better.


Top
 Offline Profile  
 
PostPosted: 18 Jun 2012, 00:12 
Moderator
User avatar

Joined: 29 Apr 2005, 00:14
Location: #moddev - join it!
Perhaps you can? PL's code is the simplest implementation possible, putting possible performance issues aside, what doesn't it do that you require?


Top
 Online Profile  
 
PostPosted: 18 Jun 2012, 00:32 
Moderator

Joined: 05 Aug 2009, 19:42
Skimming PL's code a bit it seems it only draws unit models on top of unit models (i.e it draws unitdefs that are 'attached' to certain units), didn't bother to read it all though.

Btw, smoth, are those attached models of yours supposed to be doing any sort of collision or other interaction with other objects, such as bullets, units, or the world?
Because if not, you probably don't need any more complex implementation than what PL's showing. Not even sure if performance is an issue if you can live with those *models* being unitdefs, at least formally (but hey, you don't mind hacking stuff so that unintended use isn't a problem :))


Top
 Offline Profile  
 
PostPosted: 18 Jun 2012, 00:54 
Content Developer
User avatar

Joined: 13 Jan 2005, 00:46
Location: ModalitÃ
FLOZi wrote:
Perhaps you can? PL's code is the simplest implementation possible, putting possible performance issues aside, what doesn't it do that you require?

Would have to look into if it was compatible with jk's normal shader. As I have some custom shader stuff I want to do.

I have not had the chance to look at his code, did he change it from the old stuff that greatly?


Top
 Offline Profile  
 
PostPosted: 18 Jun 2012, 08:58 
Moderator
User avatar

Joined: 22 Feb 2006, 01:02
Location: cheap kitchen
lost my post, short:
Tested and worked. (in current version of spring)
Neat! :-)

Could not get it work in my mod when copying over the stuff. (no errors, nothing showed up, i edited the config thing to use my unitnames)
Needs changes in gadgets.lua or other such files?

Btw would this also work to add transparent pieces to units?
I was testing that a while ago but in a much lamer attempt (4 empty pieces on model and draw a quad between=zomg glass window)
But yours might work for real transparent cockpits and such?

Quote:
Skimming PL's code a bit it seems it only draws unit models on top of unit models (i.e it draws unitdefs that are 'attached' to certain units), didn't bother to read it all though.
I think the files in widgets\ are for drawing "real" extra pieces instead of "fake unitdef pieces"


Top
 Offline Profile  
 
PostPosted: 18 Jun 2012, 09:36 
Battletech Developer
User avatar

Joined: 21 May 2007, 01:09
Location: New Zealand
yeah, the widgets are tests from ~2007, using a custom model loader that trepan wrote.

I will remove them from the next test release.

Yes knorke, it *could* do translucency, but I have more pressing issues (like coding for multiple extra pieces at once)


Top
 Offline Profile  
 
PostPosted: 18 Jun 2012, 09:52 
Battletech Developer
User avatar

Joined: 21 May 2007, 01:09
Location: New Zealand
New version 4.1

Minor change to config file & config loading to enable more than one add-on piece to be drawn.

Todo:

Make a better test package!


Attachments:
multitextest4-1.sdd.zip [217.42 KiB]
Downloaded 14 times
Top
 Offline Profile  
 
PostPosted: 18 Jun 2012, 13:59 
Moderator
User avatar

Joined: 29 Apr 2005, 00:14
Location: #moddev - join it!
smoth wrote:
FLOZi wrote:
Perhaps you can? PL's code is the simplest implementation possible, putting possible performance issues aside, what doesn't it do that you require?

Would have to look into if it was compatible with jk's normal shader. As I have some custom shader stuff I want to do.

I have not had the chance to look at his code, did he change it from the old stuff that greatly?


Ah yes, that would be a problem.


Top
 Online Profile  
 
PostPosted: 19 Jun 2012, 11:33 
Battletech Developer
User avatar

Joined: 21 May 2007, 01:09
Location: New Zealand
knorke wrote:
Could not get it work in my mod when copying over the stuff. (no errors, nothing showed up, i edited the config thing to use my unitnames)
Needs changes in gadgets.lua or other such files?

It needs a customparam in the unitdef, "unitdraw" (any value will work,its only used for an 'if(customparam:unitdraw != nil)' check) I probably should have mentioned that earlier :oops:


Top
 Offline Profile  
 
PostPosted: 19 Jun 2012, 11:50 
Moderator
User avatar

Joined: 22 Feb 2006, 01:02
Location: cheap kitchen
oh, i did not scroll down that far :o
hooray the tank-helicopter!
Image


Top
 Offline Profile  
 
PostPosted: 20 Jun 2012, 02:51 
Battletech Developer
User avatar

Joined: 21 May 2007, 01:09
Location: New Zealand
Gonna have a crack at using Spring.UnitRendering to do this tonight. I'm just not sure whether I should load all the DLists at gamestart/gadgetinit or one by one at UnitCreated. I feel there are pros and cons to each approach:

GameStart:
pros:
all over and done with in one hit
cons:
possibly high memory use+waste from loading [potentially] many DLists that arent being used

UnitCreated:
pros:
probably lower memory usage (only Dlists that are needed are created)
cons:
possible cpu/gpu use spikes when the DList is loaded
having to do more checks to make sure lists aren't duplicated

anything I have missed? suggestions?


Top
 Offline Profile  
 
PostPosted: 20 Jun 2012, 15:07 
Moderator
User avatar

Joined: 22 Feb 2006, 01:02
Location: cheap kitchen
I guess it depends on the game this is used for?
eg do you have lots of different "pieces" but only a few will ever be used at the same time?
(say zK commanders, with each players commander picking 1 "weapon piece" out of over 9000 available)
Or are there only a few pieces but many instances of them will be used at the the same time? (say a spammable tank that you can equip with a radar)


Top
 Offline Profile  
 
PostPosted: 20 Jun 2012, 17:18 
Content Developer
User avatar

Joined: 13 Jan 2005, 00:46
Location: ModalitÃ
I prefer as needed, should there be a situation where there are A LOT of options, if you load it all at game start

1: gpu memory suddenly becomes an issue
2: you stand a chance at triggering hand detection
3: you absolutely will load more than you need, I doubt that there will ALWAYS be a need to have more than 80% of the units built out.


Top
 Offline Profile  
 
PostPosted: 20 Jun 2012, 17:39 
User avatar

Joined: 02 May 2005, 02:56
Location: Canada
It would be ideal if you could asynchronously load the extra model and texture into memory while you are performing the upgrade that adds the new object... this stuff shouldn't need to be synced as it's an entirely visual change.


Top
 Online Profile  
 
PostPosted: 20 Jun 2012, 18:53 
Kernel Panic Co-Developer
User avatar

Joined: 16 Nov 2004, 13:08
smoth wrote:
2: you stand a chance at triggering hang detection
Use Spring.ClearWatchDogTimer()


Top
 Offline Profile  
 
PostPosted: 20 Jun 2012, 20:25 
Battletech Developer
User avatar

Joined: 21 May 2007, 01:09
Location: New Zealand
smoth wrote:
I prefer as needed, should there be a situation where there are A LOT of options, if you load it all at game start

1: gpu memory suddenly becomes an issue
2: you stand a chance at triggering hand detection
3: you absolutely will load more than you need, I doubt that there will ALWAYS be a need to have more than 80% of the units built out.



This. Definately going for on-demand loading.

Current status!
Complete:
model loading
displaylist generation

To Do:
figure out why UnitDraw wasn't working last night
sanity check for loading models and generating displaylists (don't generate the same one twice)
comment code!

knorke wrote:
I guess it depends on the game this is used for?
eg do you have lots of different "pieces" but only a few will ever be used at the same time?
(say zK commanders, with each players commander picking 1 "weapon piece" out of over 9000 available)
Or are there only a few pieces but many instances of them will be used at the the same time? (say a spammable tank that you can equip with a radar)


In the case of the ZK commanders, it wouldnt matter if the gadget loaded the models at gamestart or when the unit is created because commanders are created at gamestart anyway. For that implimentation, the code would need to be modified so that it loaded the model/DList when the upgrade is selected, the current coding will only really work for units with a static need for 'extras'

eg: E&E units which have a common chassis but different turrets and weapons, but each unit retains the same model from the moment of creation to the moment of destruction.

In E&E I could use lvl1tankchassis.s3o as the base of the unit which is the model defined in the unit fbi/lua, set up with just the chassis of the unit, and empty point objects for the turret, barrel and firing point. Then in an s3o called lvl1tankturrets.s3o I have all the turrets and weapons used by the lvl1 tanks. in the config i write:

Code:
lvl1cannontank={"lvl1tankturrets","cannonturret","turret"},{"lvl1tankturrets","cannonbarrel","barrel"},
lvl1missiletank={"lvl1tankturrets","missileturret","turret"},{"lvl1tankturrets","missilebarrel","barrel"},


[where the format is {"ModelSourceUnitDefID","ModelSourcePieceName","TargetPieceName"}]

which sticks the cannon turret and barrel on the cannontank and the missile turret and 'barrel' on the missile tank.


Top
 Offline Profile  
 
PostPosted: 21 Jun 2012, 13:52 
Modeler
User avatar

Joined: 10 May 2009, 11:27
Location: on new sidney
Someone give this man a cookie!

testing this stuff atm


Top
 Offline Profile  
 
PostPosted: 21 Jun 2012, 21:03 
Battletech Developer
User avatar

Joined: 21 May 2007, 01:09
Location: New Zealand
Not too much point testing at the moment, the gadget design has changed massivly from the last posted version (4.1)


Top
 Offline Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 61 posts ]  Go to page Previous  1, 2, 3, 4  Next

All times are UTC + 1 hour


Who is online

Users browsing this forum: Bing [Bot] and 2 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB® Forum Software © phpBB Group

Site layout created by Roflcopter et al.