Stunts Forum

Stunts - the Game => Stunts Questions => Topic started by: WillieSLT on December 10, 2021, 01:30:14 AM

Title: Exporting 3D Car Models with Tires/Wheels
Post by: WillieSLT on December 10, 2021, 01:30:14 AM
Hello everyone. I've been playing a lot of Assetto Corsa (http://"https://store.steampowered.com/app/244210/Assetto_Corsa/") lately, and had an idea of trying to port/replicate the style of a early 90's 3D car model into the game. Then I remembered Stunts, and was wondering if there was a way to export the car models. After a bit of searching, I found this forum and the Stunts Wiki (http://"http://wiki.stunts.hu/index.php?title=Main_Page"), and then CarWorks (http://"http://www.raceforkicks.com/projects/carworks.html") and Stressed (http://"http://wiki.stunts.hu/index.php?title=Stressed") by way of that.

I tried CarWorks first, but I can't seem to get it to display 3D models for any car files (ex. carvett.res), nor could I find any key commands in the manual, or options to export anything, even if I was seeing models. My understanding is CarWorks is supposed to be able to generate wheels? Maybe that's only when importing a custom model though? I'm using Stunts v1.1, for what it's worth.

(https://i.imgur.com/DqJBrMY.jpg)

Stressed did seem to work, but it only exports the car body, which based on further searching on the forum, seems to be expected functionality? My understanding being the wheels aren't polygons, and are maybe completely separate entities from the car body model itself? I was hoping to find a way to export either a model with the wheels, or export the wheels separately as an .obj file or something similar that I could import into Blender. Worst case scenario, I guess I can try and replicate them as they're pretty simple looking cylinder shapes with a small texture on them, but I thought I would ask here first to see if anyone might have any insight into that. Thanks!
Title: Re: Exporting 3D Car Models with Tires/Wheels
Post by: alanrotoi on December 10, 2021, 02:02:06 AM
Welcome! As far as I know the 3d models are saved in .P3S files in the game and after the edit the files are .3SH Stunts can read these files perfectly.
Title: Re: Exporting 3D Car Models with Tires/Wheels
Post by: Daniel3D on December 10, 2021, 06:31:48 AM
Hi and welcome to the forum.
If you load a car in stressed you can export the model as obj file.

QuoteWorst case scenario, I guess I can try and replicate them as they're pretty simple looking cylinder shapes with a small texture on them,
It will not have wheels because they are rendered by the game engine based on a few lines. But the rest of the car can be exported easily.

In stressed car0 has the most details.
Title: Re: Exporting 3D Car Models with Tires/Wheels
Post by: alanrotoi on December 10, 2021, 01:40:53 PM
Quote from: Daniel3D on December 10, 2021, 06:31:48 AM
In stressed car0 has the most details.

BTW is the same limit for car0 and car1?
Title: Re: Exporting 3D Car Models with Tires/Wheels
Post by: Daniel3D on December 10, 2021, 02:15:15 PM
Yes
Title: Re: Exporting 3D Car Models with Tires/Wheels
Post by: WillieSLT on December 10, 2021, 02:20:26 PM
Thank you for confirming that Daniel3D/alanrotoi. I had already gone through that process in Stressed with the Corvette model, so I will just continue to do that with any other models, and do my best to recreate the tires/wheels in Blender. :)
Title: Re: Exporting 3D Car Models with Tires/Wheels
Post by: Daniel3D on December 10, 2021, 02:39:16 PM
If you share the cars with anyone please mention the source and our forum. In case someone gets nostalgic and wants to race old school  8)
Title: Re: Exporting 3D Car Models with Tires/Wheels
Post by: WillieSLT on December 10, 2021, 03:05:48 PM
Quote from: Daniel3D on December 10, 2021, 02:39:16 PM
If you share the cars with anyone please mention the source and our forum. In case someone gets nostalgic and wants to race old school  8)
Absolutely. I'll make sure to share on here if I can get one of them into AC as well so anyone who maybe plays it can try a Stunts car in more of a simulator.
Title: Re: Exporting 3D Car Models with Tires/Wheels
Post by: Cas on December 10, 2021, 09:36:28 PM
Hi, Willie!

And yes. The reason why you weren't able to open the 3D shapes in CarWorks is because original cars come with its files packed (P3S for the 3D shape and PVS for the dashboard images) and only the RES file (that contains the behaviour information mostly) can be directly read. There's another tool called "stunpack" that comes with Stressed and can be used to unpack these files to 3SH and VSH, which CarWorks can read. Correctly configured, CarWorks will automatically call this tool when reading compressed files. The current version is missing a few things, but does indeed generate the wheels (although it doesn't display them in the 3D view).

3D shapes in Stunts are stored in a way that can represent polygons up to 10 sides, but also wheels, points, line segments and spheres. When Stressed and CarWorks export to OBJ, there is nothing they can use to represent anything that's not a polygon, so these items are not exported. It would be possible to make a tool that can export to OBJ in a way that's more oriented towards using the model in Blender and other tools, but without the intention of later bringing the model back to Stunts. In that case, wheels and spheres could be rebuilt as sets of polygons and line segments could be represented as thin polygons. I've considered this at some point. It's some work and it's probably easy enough to just recreate these items in Blender, but maybe one day I'd do that. Somebody asked some time ago about a tool to export a Stunts track with all of its elements to a format readable by Blender. The difficulty would be exactly the same. Both things could be solved with the same procedure.
Title: Re: Exporting 3D Car Models with Tires/Wheels
Post by: llm on December 13, 2021, 12:20:19 PM
@Cas
QuoteIt would be possible to make a tool that can export to OBJ in a way that's more oriented towards using the model in Blender and other tools, but without the intention of later bringing the model back to Stunts. In that case, wheels and spheres could be rebuilt as sets of polygons and line segments could be represented as thin polygons. I've considered this at some point. It's some work and it's probably easy enough to just recreate these items in Blender, but maybe one day I'd do that.

im waiting for that day :)

would so great to make a Stunts movie in Blender - still flat shaded but maybe with ligthing, shadows etc., or a glass/chrome version :)
Title: Re: Exporting 3D Car Models with Tires/Wheels
Post by: Daniel3D on December 13, 2021, 12:47:59 PM
I believe that it is possible to (if all shapes are exported as obj) program a track loader within softimage xsi.
I've never got so far in my learning of the program, and I'm 20 years out of practice... But I will look into it.
I could export any track as obj that way..
Title: Re: Exporting 3D Car Models with Tires/Wheels
Post by: llm on December 13, 2021, 02:48:06 PM
Quote from: Daniel3D on December 13, 2021, 12:47:59 PM
I believe that it is possible to

its not a question of possiblity - its only a too less spare time on my side :)
Title: Re: Exporting 3D Car Models with Tires/Wheels
Post by: Daniel3D on December 13, 2021, 06:32:49 PM
Then we have the same idea/problem  8)
Title: Re: Exporting 3D Car Models with Tires/Wheels
Post by: WillieSLT on December 13, 2021, 07:38:01 PM
Quote from: Cas on December 10, 2021, 09:36:28 PM
The reason why you weren't able to open the 3D shapes in CarWorks is because original cars come with its files packed (P3S for the 3D shape and PVS for the dashboard images) and only the RES file (that contains the behaviour information mostly) can be directly read. There's another tool called "stunpack" that comes with Stressed and can be used to unpack these files to 3SH and VSH, which CarWorks can read. Correctly configured, CarWorks will automatically call this tool when reading compressed files. The current version is missing a few things, but does indeed generate the wheels (although it doesn't display them in the 3D view).
Thanks for that explanation. I had read that CarWorks allowed for importing and setup of custom cars, so I figured it was full intended for that after I wasn't able to view the base cars models by default. I was unaware of "stunpack" for Stressed, but thanks for mentioning that!

Quote from: Cas on December 10, 2021, 09:36:29 PM
3D shapes in Stunts are stored in a way that can represent polygons up to 10 sides, but also wheels, points, line segments and spheres. When Stressed and CarWorks export to OBJ, there is nothing they can use to represent anything that's not a polygon, so these items are not exported. It would be possible to make a tool that can export to OBJ in a way that's more oriented towards using the model in Blender and other tools, but without the intention of later bringing the model back to Stunts. In that case, wheels and spheres could be rebuilt as sets of polygons and line segments could be represented as thin polygons. I've considered this at some point. It's some work and it's probably easy enough to just recreate these items in Blender, but maybe one day I'd do that.
Thanks for the explanation of that as well. Once I saw that Stressed broke the pieces down into polygon and non polygon based elements, and it wasn't exporting the wheels/tires, I figured it wasn't possible in either program. If I get around to this idea, I'll either just try and make some simple cylindrical wheels in Blender, or take some existing wheels from a similar AC car if need be for physics. It might not like perfectly smooth wheels/tires in that game.

Quote from: Cas on December 10, 2021, 09:36:30 PM
Somebody asked some time ago about a tool to export a Stunts track with all of its elements to a format readable by Blender. The difficulty would be exactly the same. Both things could be solved with the same procedure.
I think I saw that discussion actually before posting this thread. Totally understandable about the difficulty involved. Would still be interesting to see it though, so mark me down as someone would would like to see it happen someday. 👍
Title: Re: Exporting 3D Car Models with Tires/Wheels
Post by: Cas on December 13, 2021, 09:19:18 PM
Sure!  I would like to have that too. Maybe I should start with what's available first. Also, I'm not sure if OBJ would be the best format for such a big thing like transforming the whole track with cars, etc. Perhaps it could perfectly be, but maybe some other of the formats that Blender can recognise will have more features. For example, another thing that OBJ files can't handle is grilles, which are extensively used in Stunts 3D shapes. The easiest adaptation would be to replace that with a transparency index, but it's not the same. I'm not very "proficient" at Blender, but I'm pretty sure there is a way to create grille textures and then apply them in a way that they remain transparent in some parts.
Title: Re: Exporting 3D Car Models with Tires/Wheels
Post by: Daniel3D on December 14, 2021, 12:40:11 AM
Quote from: Cas on December 10, 2021, 09:36:28 PM
Somebody asked some time ago about a tool to export a Stunts track with all of its elements to a format readable by Blender.
There is a program made in Unity that does just that.
But although it creates the track I couldn't get textures to work. It also doesn't work with the current version of Unity and you can't export the data.
So I'm not sure if it is useful. But definitely possible.
Title: Re: Exporting 3D Car Models with Tires/Wheels
Post by: llm on December 14, 2021, 07:01:10 AM
Quote
There is a program made in Unity that does just that.
But although it creates the track I couldn't get textures to work. It also doesn't work with the current version of Unity and you can't export the data.

This one?
https://github.com/cobbpg/stunts-unity

Title: Re: Exporting 3D Car Models with Tires/Wheels
Post by: Daniel3D on December 14, 2021, 07:14:39 AM
Quote from: llm on December 14, 2021, 07:01:10 AM
Quote
There is a program made in Unity that does just that.
But although it creates the track I couldn't get textures to work. It also doesn't work with the current version of Unity and you can't export the data.

This one?
https://github.com/cobbpg/stunts-unity
Yes, that one.
Title: Re: Exporting 3D Car Models with Tires/Wheels
Post by: Cas on December 14, 2021, 01:38:33 PM
How curious. The program idea, I was imagining as a simple generator, with no graphics at all. You give it a track, it gives you a 3D file. I can do that more or less quickly if no wheels, no spheres and no grilles.
Title: Re: Exporting 3D Car Models with Tires/Wheels
Post by: llm on December 14, 2021, 01:45:01 PM
Quote from: Cas on December 14, 2021, 01:38:33 PM
How curious. The program idea, I was imagining as a simple generator, with no graphics at all. You give it a track, it gives you a 3D file. I can do that more or less quickly if no wheels, no spheres and no grilles.

just do it! :)
Title: Re: Exporting 3D Car Models with Tires/Wheels
Post by: llm on December 14, 2021, 01:46:49 PM
Quote... if no wheels, no spheres and no grilles.

i think you will add that very fast if the pure exporting is running - its not looking that nice without - that will harm your strive in harmony :)
Title: Re: Exporting 3D Car Models with Tires/Wheels
Post by: Daniel3D on December 14, 2021, 04:33:47 PM
Generating wheels and spheres is not really difficult for an export. They are defined and there is a relationship between the 6 vertices and the size and orientation of the wheel.
The same goes for the sphere.
The grill is just a texture.
Title: Re: Exporting 3D Car Models with Tires/Wheels
Post by: llm on December 14, 2021, 04:40:30 PM
Quote from: Daniel3D on December 14, 2021, 04:33:47 PM
The grill is just a texture.

but it would be better to have the grill as real polygon object, images are always bad for system transfer or quality
Title: Re: Exporting 3D Car Models with Tires/Wheels
Post by: Daniel3D on December 14, 2021, 04:44:05 PM
That is true and I agree. I meant mostly that it is detectable. It is not trivial, probably involves some clever programming. But I'm sure it can be done.
Title: Re: Exporting 3D Car Models with Tires/Wheels
Post by: Cas on December 15, 2021, 12:27:17 AM
Ah!  I've just realised that there's one more problem: Z-fighting. Stunts allows for some things to be "drawn" on a surface by giving two polygons the same depth, but assigning one with a Z-bias attribute. The OBJ format and the Blender engine in general do not support this. You either have to create a true depth difference or use a texture, but true depth differences are pretty visible and converting between overlapping polygons and textures is far from trivial.

To make this work well, what I'd suggest is... instead of converting the original track elements on the fly, manually recreate each track element once, making it more Blender-friendly. Then, use this set to recreate the track. Optionally, there could be two sets: one that looks as similar to the original as possible and one that represents what the original was trying to achieve.
Title: Re: Exporting 3D Car Models with Tires/Wheels
Post by: Daniel3D on December 15, 2021, 08:01:47 AM
That would work.
You could also make the objects ready for your own engine and the export in two stages. First build the track (like you would for your engine) then export the total.
That way you can later include the code in your engine.
Title: Re: Exporting 3D Car Models with Tires/Wheels
Post by: Cas on December 15, 2021, 08:31:19 PM
Well, for my engine, I would use something similar to what Stunts does, though not the same. Because doing it the "right" way (Blender's way) is actually slower. Yet, it makes sense that Blender does it that way because that is a more general approach that can render anything. For games, things are usually optimised.