View topic - Attaching models onto units?



All times are UTC + 1 hour


Post new topic This topic is locked, you cannot edit posts or make further replies.  [ 23 posts ]  Go to page 1, 2  Next
Author Message
PostPosted: 22 May 2012, 15:45 
Content Developer
User avatar

Joined: 13 Jan 2005, 00:46
Location: ModalitÃ
I remember someone had some WIP code for this, I figure with JK's normal shader and a bit of bashing code together I might be able to do some customization stuffs but I need to know how to attach a model to a unit piece, receive base direction and rotate with that piece.


Top
 Offline Profile  
 
PostPosted: 22 May 2012, 16:21 
User avatar

Joined: 19 Aug 2009, 15:09
Location: Sol 3
Not sure this is what you mean, but if it concerns pilots/drivers/gunners, this might be helpful.
Image


Top
 Offline Profile  
 
PostPosted: 22 May 2012, 16:26 
Content Developer
User avatar

Joined: 13 Jan 2005, 00:46
Location: ModalitÃ
nah, I don't want to do transport hacks where I attach a whole unit onto it. I am looking at something like metal fatigue here. I want to attach gun models onto mechs.


Top
 Offline Profile  
 
PostPosted: 22 May 2012, 16:44 
Moderator
User avatar

Joined: 26 Oct 2007, 15:21
Make a shared atlas with with help of the UV transform functions in OBJ to S3O converter and then add geometry+hide unused pieces?


Top
 Offline Profile  
 
PostPosted: 22 May 2012, 16:57 
Content Developer
User avatar

Joined: 13 Jan 2005, 00:46
Location: ModalitÃ
No.

Quote:
Person a: I would like to eat this apple. Alas, it is covered in filth. How may I cleanse this apple of the filth thus rendering it edible?

Person b: The easiest way to cleanse that apple is to eat this banana instead.


Top
 Offline Profile  
 
PostPosted: 22 May 2012, 17:01 
User avatar

Joined: 23 Oct 2004, 00:43
Sadly this feature has been requested over and over again for years, I don't think it's going to happen.

Piece hide/show would probably work but I imagine there are some vicious performance considerations if you get a dozen or so parts for each slot. Codegenning some kind of precompiled list of every possible combination would probably exceed some kind of unit-type limit.


Top
 Offline Profile  
 
PostPosted: 22 May 2012, 17:05 
Content Developer
User avatar

Joined: 13 Jan 2005, 00:46
Location: ModalitÃ
Ok ffs

No
unit attachment:
- hacky as fuck, seriously no, so many issues.
Massive set of hidden parts:
- requires all the parts to use 1 atlas
- - Atlas texturing is ok but not for me, I prefer proper texturing.
- maintenance night mare


There WAS code to attach peices to a model, I remember and it worked but it didn't shade the piece properly because the person who wrote it didn't know how to shader. JK wrote a shader.

PXTL: unlike many of the idea guy assholes who ask for it, I actually have the motivation and drive to see it through. I am asking for the name of the person who wrote the peice attachment code so I can get in touch with him and finish his work.


Top
 Offline Profile  
 
PostPosted: 22 May 2012, 17:16 
User avatar

Joined: 02 May 2005, 02:56
Location: Canada
Isn't PicassoCT trying to do something like this with head-crabs in Journeywar? (IDK, maybe they are separate units)


Top
 Offline Profile  
 
PostPosted: 22 May 2012, 17:50 
Moderator
User avatar

Joined: 29 Apr 2005, 00:14
Location: #moddev - join it!
There was code that laoded obj and had non-spring textures, you'd be better off writing from scratch, smoth.

I had an idea of using features/unitdefs and http://springrts.com/wiki/Lua_OpenGL_Ap ... _Functions but I never really got to it. (i.e. 'false' units which were never created in game but simply used as a shortcut for model loading)

edit: The old code was trepan and PressureLine.


Top
 Offline Profile  
 
PostPosted: 22 May 2012, 20:08 
Content Developer
User avatar

Joined: 13 Jan 2005, 00:46
Location: ModalitÃ
notes from a conversation
Quote:
[1:39:03 PM] <smoth2> jk
[1:39:24 PM] <smoth2> what is your opinion on me trying to attach models to units
[1:39:36 PM] <smoth2> I was thinking that you do polies for stuff like lups
[1:39:46 PM] <smoth2> so maybe it won't be too expensive?
[1:46:37 PM] <[LCC]jK> attach models to units?
[1:50:47 PM] <smoth2> yeah
[1:51:01 PM] <smoth2> like say I want to use a different model for the barrel on a tank
[1:51:31 PM] <smoth2> and attach said model to the tank barrel object of the tank(which would be an empty object)
[1:53:44 PM] <smoth2> say like the guns on the top left
[1:53:44 PM] <smoth2> http://img820.imageshack.us/img820/7091/armor1.gif
[1:54:10 PM] <smoth2> I have an empty object on the arm where the gun will go
[1:54:19 PM] <smoth2> and want to attach the weapon model
[1:54:53 PM] <smoth2> I would only move the gun by moving the point it is attached to
[1:55:00 PM] <smoth2> thoughts?
[1:57:17 PM] <smoth2> fucking weblobby
[1:58:10 PM] <[LCC]jK> you could just replace the dlist
[1:58:46 PM] <smoth2> even if it is a model using a different texture?
[1:58:54 PM] <[LCC]jK> the other barrels still need to be features or units to access their dlist, but you don't need to really create an unit
[1:59:17 PM] <[LCC]jK> even then you could swap the texture with dlists
[1:59:38 PM] <smoth2> what if it is a different texture than the modeling I am attaching?
[1:59:52 PM] <[LCC]jK> http://springrts.com/wiki/Lua_UnitRendering
[2:00:04 PM] The time is now 2:00:04 PM
[2:00:31 PM] <[LCC]jK> Spring.UnitRendering.SetMaterialDisplayLists -> swap the texture in those 2 dlists (they get called before and after the piece)
[2:00:49 PM] <smoth2> oh so the attched piece can use a different source than the parent?
[2:00:56 PM] <[LCC]jK> and replace the dlist of the piece with Spring.UnitRendering.SetPieceList
[2:01:03 PM] <[LCC]jK> yup
[2:01:09 PM] <smoth2> how do I attach the model piece to another model?
[2:01:21 PM] <smoth2> oh
[2:01:26 PM] <smoth2> I grab the piece from one unit
[2:01:31 PM] <smoth2> and attach to another?
[2:03:51 PM] <[LCC]jK> yup
[2:04:10 PM] <[LCC]jK> but it seems you need to create an unit with the new model once ...
[2:04:32 PM] <smoth2> so I need to have a rack of guns somewhere on the map lol?
[2:06:36 PM] <smoth2> so if my gunrack dies?
[2:06:43 PM] <[LCC]jK> nah you just need it for an infinitesimal period
[2:06:52 PM] <[LCC]jK> to create the dlist
[2:06:56 PM] <smoth2> ah
[2:07:01 PM] <[LCC]jK> after that you can destroy the unit again


Top
 Offline Profile  
 
PostPosted: 22 May 2012, 22:02 
Moderator
User avatar

Joined: 29 Apr 2005, 00:14
Location: #moddev - join it!
Yeah I was trying to do something similar way back when (had discussed it with jk too), but my GL-fu is weak.


Top
 Offline Profile  
 
PostPosted: 22 May 2012, 22:04 
Content Developer
User avatar

Joined: 13 Jan 2005, 00:46
Location: ModalitÃ
I am interested in trying it. Currently doing some feasibility research into some ideas I have for a side project. So like feature placer... we get a few weeks of me banging away on this.


Top
 Offline Profile  
 
PostPosted: 23 May 2012, 21:38 
User avatar

Joined: 23 Oct 2004, 00:43
With the GL approach, will secondary things be aware of the model? Like selection halo widgets? Shadows?


Top
 Offline Profile  
 
PostPosted: 23 May 2012, 21:47 
Spring Developer
User avatar

Joined: 28 Jun 2007, 06:30
yup


Top
 Offline Profile  
 
PostPosted: 23 May 2012, 23:58 
Evolution RTS Developer
User avatar

Joined: 17 Nov 2005, 02:43
Location: Raegquitting Spring on 04/24/12
This is something I would very much like to have.


Top
 Offline Profile  
 
PostPosted: 24 May 2012, 03:48 
User avatar

Joined: 28 Jul 2008, 05:51
Location: Australia
smoth, could you elaborate on what is buggy about transport/fire platforms?

This capability is essential to my own project and I spent quite a lot of time on this back on 0.77 and did not encounter any serious issues. For example:

* The "turret" unit was able to track and fire at enemies accurately, even when the "chassis" unit was moving
* If the combined unit was out of range it would still close the distance and fire
* I was able to set the turret to "unselectable" so for UI purposes the combined units appeared to be a single unit.
* I was able to perform the attachment via script
* The turret would die when the fireplatform died

I'm just trying to establish if your problems are related to regressions since I last tested or you're trying to do something I didn't test.

If you can elaborate on the bugs I'd be happy to look at fixing them.

Having said that we do need to look into the ability to load, access and manipulate models for UI and world object purposes. The issue currently is that some model rendering code is still tied heavily into the unit rendering code and some refactoring/cleanup is required. Since I'm overdue for some ASSIMP patching I'll look into exposing models, pieces and textures to Lua GL.

Note to self: Look at the "Ghost buildings" widget again. Seem to recall it accesses model verts via Lua to create display lists. So does the widget that makes selected units shiny.


Top
 Offline Profile  
 
PostPosted: 24 May 2012, 05:25 
Blood & Steel Developer
User avatar

Joined: 25 Aug 2004, 12:31
Location: Has not played *a in years.
the whole transport fire platform was a bad idea... but then again last i tried was about a year ago, so maybe things are smoother?

edit: Not part of main topic! spliff i am interested in playing with your idea, do you mind sharing some code? I could use it for a few tests that I wanted to check on feasibility of attachment weapon systems. check your PM


Last edited by bobthedinosaur on 24 May 2012, 14:26, edited 1 time in total.

Top
 Offline Profile  
 
PostPosted: 24 May 2012, 13:23 
Content Developer
User avatar

Joined: 13 Jan 2005, 00:46
Location: ModalitÃ
This thread was about adding model to a unit with lua not about attaching units via the transport mechanism. Please stop pushing/ discussing this approach in my thread. I have been very clear about what I am trying to do. I ask that you have a little respect and stop proposing other possibilities, I am exploring a specific possibility, I should not have to make this post.

If you wish to explore the transport mode stuff. Do it in another thread!


Top
 Offline Profile  
 
PostPosted: 24 May 2012, 14:13 
Blood & Steel Developer
User avatar

Joined: 25 Aug 2004, 12:31
Location: Has not played *a in years.
Well be sure to share with us any updates on your GL methods. They sound promising.


Top
 Offline Profile  
 
PostPosted: 24 May 2012, 14:24 
Moderator

Joined: 12 Oct 2007, 08:24
I am interested in this too. With jK's method how does the LUS deal with the possibility of transferring pieces between units?


Top
 Offline Profile  
 
Display posts from previous:  Sort by  
Post new topic This topic is locked, you cannot edit posts or make further replies.  [ 23 posts ]  Go to page 1, 2  Next

All times are UTC + 1 hour


Who is online

Users browsing this forum: No registered users and 1 guest


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.