Shaders’ Outpost

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

Moderators: winston, another_commander

User avatar
Cholmondely
Archivist
Archivist
Posts: 5381
Joined: Tue Jul 07, 2020 11:00 am
Location: The Delightful Domains of His Most Britannic Majesty (industrial? agricultural? mainly anything?)
Contact:

Re: Shaders’ Outpost

Post by Cholmondely »

Redspear wrote: Mon May 15, 2023 9:23 pm
cbr wrote: Mon May 15, 2023 6:43 pm
Perhaps the constrictors briefing shader contains something to your lik(e)ing...
I've never actually done it :| but thanks :)

As we've both done before, a simple glowmap (no shaders) will do the trick but it's getting it to be dynamic that's the tricky part.
Redspear - any chance of your repeating what you just wrote in language that this dumb pilot has a chance of understanding?
Comments wanted:
Missing OXPs? What do you think is missing?
Lore: The economics of ship building How many built for Aronar?
Lore: The Space Traders Flight Training Manual: Cowell & MgRath Do you agree with Redspear?
User avatar
Griff
Oolite 2 Art Director
Oolite 2 Art Director
Posts: 2484
Joined: Fri Jul 14, 2006 12:29 pm
Location: Probably hugging his Air Fryer

Re: Shaders’ Outpost

Post by Griff »

Redspear wrote: Mon May 15, 2023 9:23 pm
...getting it to be dynamic that's the tricky part.
I think maybe a version of a 'fog' shader might do the trick but insteading of mixing in the 'sky colour' we'd mix in our glowmap texture

I did have a go trying to cobble together a simple oxp & shader to do this last night but i just couldn't get it working, the shader compiled OK but the glow effect was always being mixed in 100% no matter how close i got the camera to the test object so i clearly had something wrong in the distance calculating bit, i tried this guys method:

OpenGL 3D Game Tutorial 16: Fog
https://www.youtube.com/watch?v=qslBNLeSPUc

but then i found this example a bit later on just as i wa giving up
https://vicrucann.github.io/tutorials/osg-shader-fog/

might try and adapt that, it talks about needing the camera position and passing it as an uniform to the shader, i think we might be able to get away with just using the camera position as vec3(0.0, 0.0, 0.0) as i think the player camera view is fixed at that point as it's the rest of the universe that moves around them in game?
User avatar
Redspear
---- E L I T E ----
---- E L I T E ----
Posts: 2694
Joined: Thu Jun 20, 2013 10:22 pm
Location: On the moon Thought, orbiting the planet Ignorance.

Re: Shaders’ Outpost

Post by Redspear »

Cholmondely wrote: Mon May 15, 2023 9:51 pm
Redspear - any chance of your repeating what you just wrote in language that this dumb pilot has a chance of understanding?
A ship model isn't fully dressed without a texture and such forms of attire often constitute multiple parts, some more conventional (the pants if you like) and others more optional (a hat for example).

A glowmap is like adorning a texture with lights. In the absence of shaders (mobile lighting, makeup and camera crew) they are just on, always on and with no dimmer switch, as in my screenshot example (the glowmap is the layer of the texture that is illuminating the wireframe).

What I've been wittering on about lately is how such a feature might be aligned to a shader, so that it is made much more obvious in some situations (e.g. far from player ship) and much less so in others (close to player ship). How to adequately express this desire to the photography team (shaders) is very much the question.

Griff wrote: Tue May 16, 2023 7:21 am
i think the player camera view is fixed at that point as it's the rest of the universe that moves around them in game?
Yes, or at least that's my understanding.

Thanks so much for looking into this! :D
User avatar
Griff
Oolite 2 Art Director
Oolite 2 Art Director
Posts: 2484
Joined: Fri Jul 14, 2006 12:29 pm
Location: Probably hugging his Air Fryer

Re: Shaders’ Outpost

Post by Griff »

Distance dependant glow texture effect:
Ha, well I've made a bit of progress, except the effect is working in reverse at the moment :lol:, it fades IN the closer the player gets to the object, and the effect in/out range needs scaling out a lot more as at the moment the effect only kicks in when the player is eally close to the object

Work in progress OXP here:
https://drive.google.com/file/d/1SZUCS2 ... share_link

With the OXP installed - when you launch from a station it will spawn 4 sidewinders (with dumbAI) around the immediate area, fly up to one to see the effect, and i mean you have to get quite close, plus i've only tested using the regular forward view i'm just assuming in the shader that the player camera position is always 0,0,0 - not sure if external views will change that?

edit: smoothstep fixed the problem with the effect working in reverse, had to experiment with the smoothstep upper and lower range values, 1.0-0.0 nmeant the effect wouldn;t fade out near the player, 0.5-0.0 and it fades out just as the playeris alongside it, decided to go with 0.4-0.0 so it fades out a few meters before the player,lower the 0.4 to fade it out earlier (line 162 in fragment shader)


edit:
Arg, I've just realised i'm REPLACING the ship colour texture with the glow grid as you get closer, to be more in line with Redspears concept where the glow lines are overlayed on top of the texture, edit the fragment shader and swap out this vec4 FinalColwithGlow... bit

// get a vec4 to store our final colour and mix in glow effect
vec4 FinalColwithGlow = mix(totalColor, GlowGrid, visibility);

for this:

// get a vec4 to store our final colour and mix in glow effect
vec4 FinalColwithGlow = totalColor + mix(vec4(0), GlowGrid, visibility);
User avatar
Redspear
---- E L I T E ----
---- E L I T E ----
Posts: 2694
Joined: Thu Jun 20, 2013 10:22 pm
Location: On the moon Thought, orbiting the planet Ignorance.

Re: Shaders’ Outpost

Post by Redspear »

Griff wrote: Wed May 17, 2023 7:23 pm
Ha, well I've made a bit of progress
Griff, thanks so much :D Looks like a lot of the hard work has been done.

The following has to be said I believe:
I don't own it so I can't upload it but...
User avatar
Griff
Oolite 2 Art Director
Oolite 2 Art Director
Posts: 2484
Joined: Fri Jul 14, 2006 12:29 pm
Location: Probably hugging his Air Fryer

Re: Shaders’ Outpost

Post by Griff »

I've made a small change to the shaders in the posglow test OXP, I borrowed some of the code from Oolite's planet shader and used it to just limit the glowing wireframe to the unlit sides of the object - the previous shaders that didn't do this are also in the download if we don't like the effect ew can always go back, it might have been the orange of the texture and the green of the glow effect but it was putting a weird looking yellow grid on the ship when it was in bright sunlight and close enough to the camera for the effect to start fading but not close enough for it not to be drawn, I wanted to see if i could get rid of that

@Redspear, is there a link to this cobraIII and the wireframe texture it has on it? - like in your screenshot...
Image
.. would be nice to try the shader on a proper ship now instead of the test sidewinder, see if we can get it to look like this :D
User avatar
cbr
---- E L I T E ----
---- E L I T E ----
Posts: 1425
Joined: Thu Aug 27, 2015 4:24 pm

Re: Shaders’ Outpost

Post by cbr »

Image

Perhaps You are already there ;) ...

Here I replaced the grid with a 'line-art' conversion of the 512p diffusemap.
( extra experiment I partially removed the color in the diffusemap to view its influence on the shader at distance )

The downside will be finding shader magic to perform the line art conversion...

8)
User avatar
Redspear
---- E L I T E ----
---- E L I T E ----
Posts: 2694
Joined: Thu Jun 20, 2013 10:22 pm
Location: On the moon Thought, orbiting the planet Ignorance.

Re: Shaders’ Outpost

Post by Redspear »

Griff wrote: Thu May 18, 2023 12:08 pm
@Redspear, is there a link to this cobraIII and the wireframe texture it has on it? - like in your screenshot...

.. would be nice to try the shader on a proper ship now instead of the test sidewinder, see if we can get it to look like this :D
Sort of...

It's from Simon B's [EliteWiki] Re2dux Ships.
I've included (and removed the partial transparency from) the tweaked glowmap for the cobra 3 below:

Image

Given the new strategy of fading at close range, it should probably have thicker wireframe lines but then it was a proof of concept with largely hand/mouse drawn lines.
Griff wrote: Thu May 18, 2023 12:08 pm
I borrowed some of the code from Oolite's planet shader and used it to just limit the glowing wireframe to the unlit sides of the object
As I tried to say before but failed...

You, Sir...

Thanks so much for your help with this Griff :D

cbr wrote: Thu May 18, 2023 2:56 pm
Image
The irrepressible cbr! 8)
User avatar
cbr
---- E L I T E ----
---- E L I T E ----
Posts: 1425
Joined: Thu Aug 27, 2015 4:24 pm

Re: Shaders’ Outpost

Post by cbr »

Image

A thicker glow_frame with a subdued hexagon pattern, adjusted color(?) in shader to white...
User avatar
Redspear
---- E L I T E ----
---- E L I T E ----
Posts: 2694
Joined: Thu Jun 20, 2013 10:22 pm
Location: On the moon Thought, orbiting the planet Ignorance.

Re: Shaders’ Outpost

Post by Redspear »

cbr wrote: Fri May 19, 2023 7:53 pm
A thicker glow_frame with a subdued hexagon pattern, adjusted color(?) in shader to white...
Nice. Those lines look about right in terms of thickness.

Are the hexagons there to make it more obvious that it is meant to be imposed by your ship's computer rather than actually present on the ship's surface?
Different colours have always been part of my plan 8)

Griff wrote: Thu May 18, 2023 12:08 pm
I borrowed some of the code from Oolite's planet shader and used it to just limit the glowing wireframe to the unlit sides of the object - the previous shaders that didn't do this are also in the download if we don't like the effect ew can always go back
Not tried it yet but think it's a great idea :D .

I tried to achieve this previously and this is why the original wireframe was partially transparent - to make it less obvious when the ship was lit. That was always a compromise however (when lit less was more, when unlit more was more), so I removed the transparency from the glowmap that I posted above to better work with your superior method.
User avatar
cbr
---- E L I T E ----
---- E L I T E ----
Posts: 1425
Joined: Thu Aug 27, 2015 4:24 pm

Re: Shaders’ Outpost

Post by cbr »

Redspear wrote: Sat May 20, 2023 6:00 pm

Are the hexagons there to make it more obvious that it is meant to be imposed by your ship's computer rather than actually present on the ship's surface?
Indeed!

Wanna play?

Image

:D
User avatar
Griff
Oolite 2 Art Director
Oolite 2 Art Director
Posts: 2484
Joined: Fri Jul 14, 2006 12:29 pm
Location: Probably hugging his Air Fryer

Re: Shaders’ Outpost

Post by Griff »

I was just looking at the latest posts and it got me wondering what if we built the actual wireframe out of real glowing polygons around the object? a couple of polys for each 'wireframe edge' scaled up from the ship model a small amount so it draws over the ship hull underneath? would be pretty light in terms of poly count if we base it on the original 8 bit elite ship geometry?

Wireframes could be subentities with their own shader to do the effect so just a model.dat for each ship wireframe model and a subentity for it added to the parent shipentry in shipdata.plist? Might be possible to add this as a shipdata-overrides.plist in a seperate oxp?

Pros: less textures used, wireframe drawn much higher res on screen

Cons: more polygons, won't be able to fade out the wireframe based on distance, instead it will have to either be 'on' or 'off' depending on how close the object is to the camera but we could maybe gradually dim the wireframe glow towards black dependant on distance before switching it off totally to make the change less jarring?

Or we could have a combination of stuff, wireframe as a seperate model and the texture effect like cbr's hexagons as well?
User avatar
cbr
---- E L I T E ----
---- E L I T E ----
Posts: 1425
Joined: Thu Aug 27, 2015 4:24 pm

Re: Shaders’ Outpost

Post by cbr »

Image

If we are thinking out of the box, if it were possible to access the wireframe mode from oolite at the same time?
Then we could have this ( simulated ) effect.. Pros ( it's calculated ) Cons ( A_C says no ) :wink: 8) :D

Btw the shader seems to work in wireframe mode too :lol:
User avatar
Redspear
---- E L I T E ----
---- E L I T E ----
Posts: 2694
Joined: Thu Jun 20, 2013 10:22 pm
Location: On the moon Thought, orbiting the planet Ignorance.

Re: Shaders’ Outpost

Post by Redspear »

:shock: Some very exciting suggestions guys...

It might be easier to find the best 'solution' if the 'problem' is made explicit (at least for me).
Check out thie 'In shadow' images of the python docking.

Can't see a damn thing, even when ambient light is ramped up. Both a waste of a good ship model/texture and makes combat/gameplay trickier/less satisfying.

My idea of having the wireframe fade with distance was mainly because I didn't know how to have it merely illuminate on the unlit areas;
thus the cobra image upthread experimentng with transparency. In that image the wireframe is more obvious on the unlit parts - I did try increasing transparency further but with limited gains.

Griff wrote: Sat May 20, 2023 6:39 pm
I was just looking at the latest posts and it got me wondering what if we built the actual wireframe out of real glowing polygons around the object? a couple of polys for each 'wireframe edge' scaled up from the ship model a small amount so it draws over the ship hull underneath? would be pretty light in terms of poly count if we base it on the original 8 bit elite ship geometry?

Wireframes could be subentities with their own shader to do the effect so just a model.dat for each ship wireframe model and a subentity for it added to the parent shipentry in shipdata.plist? Might be possible to add this as a shipdata-overrides.plist in a seperate oxp?
Sounds great :D I think the original elite wireframes (or very close to) is the way to go as they are both iconic and uncluttered. To be completely honest, I also miss them. Wanted to include them in a HUD targeting element for ages and the suggestions here might be a way to bring them back without losing the marvelous progress that's been made with regards poly counts and design by the likes of yourself.

cbr wrote: Sat May 20, 2023 7:13 pm
If we are thinking out of the box, if it were possible to access the wireframe mode from oolite at the same time?
Then we could have this ( simulated ) effect.. Pros ( it's calculated ) Cons ( A_C says no ) :wink: 8) :D
I remember being quite disappointed when I first tried wireframe mode in oolite because it showed every line including the ones that elite didn't.

Griff wrote: Sat May 20, 2023 6:39 pm
Cons: more polygons, won't be able to fade out the wireframe based on distance, instead it will have to either be 'on' or 'off' depending on how close the object is to the camera but we could maybe gradually dim the wireframe glow towards black dependant on distance before switching it off totally to make the change less jarring?
If on/off could corresponded to lit/unlit then that could be awesome, and the fact that there was no fading needn't be a problem :D

Griff wrote: Sat May 20, 2023 6:39 pm
Or we could have a combination of stuff, wireframe as a seperate model and the texture effect like cbr's hexagons as well?
cbr's hexagon idea is definitely growing on me. Shows how well designed it was that I instinctively guessed the intention behind it.
If we can achieve the 'unlit surface/area = wireframe on' look, then the hexagons might help at close range to remind the player that it is a solid object. Subtle enough to be a reminder rather than overwhelming.


With regards colours, it would probably be better to make freighters blue (lighter for visibilty but not enough to mistake for cyan) and stations red.
  • Then (using the RGB model)
    • All non alien ships would contain an element of blue (blue, cyan, magenta)
      All system hazards/features would contain some red (red, magenta, yellow)
      Leaving green for the thargoids
      And white for debris/unknown
User avatar
Griff
Oolite 2 Art Director
Oolite 2 Art Director
Posts: 2484
Joined: Fri Jul 14, 2006 12:29 pm
Location: Probably hugging his Air Fryer

Re: Shaders’ Outpost

Post by Griff »

doing the wireframe with some extra polygon geometry turned out to look rubbish :( I've uploaded it into the WIP .zip as a second OXP since it works so might as well, but it doesn't look great

I've modified the texture based method so the glow colour is now in the shipdata.plist, edit the values there to change the glow colour, plus
I found a guide online on how to bake out a wireframe texure map based on the boundaries of the UV islands in the model, so i've switched that generic grid texture i was using for this new texture map which follows redspears concept a lot closer
Post Reply