Multiple textures

Discussion and information relevant to creating special missions, new ships, skins etc.

Moderators: winston, another_commander

Post Reply
User avatar
Shipbuilder
---- E L I T E ----
---- E L I T E ----
Posts: 877
Joined: Thu May 10, 2012 9:41 pm
Location: Derby

Multiple textures

Post by Shipbuilder »

Does anyone know if it is possible to produce a texture for a ship and then produce a series small texture file which could be randomly added to the main texture.

For example a ship texture could be created which would be applied to all versions of a particular ship. A choice of a series of ship serial numbers could then be randomly applied over the 'base' texture.
The GalTech Industries Corporation - Building ships to populate the galaxies.

Increase the variety of ships within your Ooniverse by downloading my OXPs

Flying the [wiki]Serpent_Class_Cruiser[/wiki] "Thargoid's Bane"
User avatar
Thargoid
Thargoid
Thargoid
Posts: 5528
Joined: Thu Jun 12, 2008 6:55 pm

Re: Multiple textures

Post by Thargoid »

Yes you can - either set the model up with two textures (one for the main bulk of the ship and a second specifically for the sections you want to change) and then swap the second one by script, or do something similar with a shader.

In the second case just add the two textures together, with suitable "holes" in each to match the other so that when added together you get a single complete texture. Then each ship would use the same shader but with different textures fed to it.
User avatar
Griff
Oolite 2 Art Director
Oolite 2 Art Director
Posts: 2479
Joined: Fri Jul 14, 2006 12:29 pm
Location: Probably hugging his Air Fryer

Re: Multiple textures

Post by Griff »

If you fancy trying this with shaders Jens wrote a decal shader that's perfect for this kind of task start here https://bb.oolite.space/viewtopic.php?p=42045#p42045 for the code examples (with lots of explanation) and continue on for the next few pages as more and more features get added in to the code.
I find it a complex thing to follow but I did (after much trial and error) manage to get the multiple decal version working as a function inside the shaders in my shipset, if you feel this might something you want to try in your oxp we could have a go transplanting this code into a new shader in your simple shaders request thread ( mind you the last time I tried to move this code into a different shader I ended up with decals that only appeared in sunlight, they vanished on the shadowed side of the ship :lol: I got things confused somewhere!)
User avatar
submersible
Commodore
Commodore
Posts: 264
Joined: Thu Nov 10, 2011 7:49 am

Re: Multiple textures

Post by submersible »

See also some of the griff ship shader uniforms, particularly those with decals, and ones using 'randomUnitVector' . I too am looking into way of producing variant ships based on one original.

Investigate 'randomUnitVector' as a shader uniform . Not sure if 'randomFloat' or 'randomInt' exists but you could modulate something to be a 0-4 integer then use that as a mask in your shader to mix() between your default texture and another, in patterns defined by the r,g,b or a channel of a third texture.
Post Reply