Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to add new models? #17

Open
dnzg opened this issue Apr 12, 2023 · 1 comment
Open

How to add new models? #17

dnzg opened this issue Apr 12, 2023 · 1 comment

Comments

@dnzg
Copy link

dnzg commented Apr 12, 2023

Hey! I wanted to help with adding new vehicles models here, but I haven't found any guide on how to prepare the 3D model for that. Could you help me with it?

@theshanergy
Copy link
Owner

theshanergy commented Apr 12, 2023

Thanks for the interest - If you would like to contribute new vehicle models there are a few things to be aware of:

Vehicles should be sized correctly in meters according to their equivalent real world dimensions. Specifically the width as well as the distance between wheel placement and bumper to bumper should be accurate.

The distance from center along the forward axis needs to be the same for the front and rear axles. ie. the vehicle should be centered in the scene based on the position of its hypothetical wheels rather than its body.

Models should be exported in GLTF format (.glb file extension) with +Y axis up. You should apply all modifiers and include normals. It should not export any lighting, animations, UVs, vertex colors, attributes, etc. It should also not contain any wheels (rims and tires can be added separately). I try to keep the file size as small as possible while retaining clean lines and geometry. I've found the sweet spot is somewhere around 1MB for a nice looking compressed GLTF model.

Models should contain only basic materials and no textures. Some materials will be modified by the editor by name, these include: body, chrome, mirror, glass, glass_tint, glass_dark, rubber, and black. The uses of these materials should be self evident by their name. Materials with names other than the above will not be processed and will display as-is. You can see how materials are processed in hooks/useMaterialProperties.js

Models can be placed in /public/assets/models/vehicles/ in their respective make and model folder, with a subfolder for model generation if applicable.

To add the new model to the scene and interface you can modify the 'vehicles' object in the vehicleConfigs.js file. A vehicle looks like this:

toyota_4runner_5g: {
name: 'Toyota 4Runner (2011-2013)', // Title to show in select list.
make: 'Toyota', // Make to group by in select list.
model: 'assets/models/vehicles/toyota/4runner/5g/4runner.glb', // Relative model path.
wheel_offset: 0.76, // Distance from center to wheel along the width axis.
wheelbase: 2.789, // Axle to axle distance on forward axis.
default_addons: {},
addons: {},
},

The vehicle should be keyed with a unique lowercase string that includes the make model and year or generation.

If you would like to include vehicle addons, they can be exported separately from the main model and included in the vehicle folder. You can refer to 'toyota_4runner_3g' in vehicleConfigs.js for an example of the data structure.

Lastly, just make sure that you have permission to use any models you contribute. I've tried to stick with only public or purchased models, or those of my own creation.

If you are comfortable with the above you can open a pull request which contains your new vehicle and I will review. Assuming it looks good and is cohesive with the site and existing models I will merge it to the live branch.

Hopefully that clarifies the process a bit, but let me know if you have any questions.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants