Custom Shaders?

Help bring our custom Ages to life! Share tips and tricks, as well as code samples with other developers.

Custom Shaders?

Postby Aloys » Thu Apr 16, 2020 4:41 am

I'm pretty sure the answer is "no"; but just to be sure: can we write custom shaders for an Age?
It is my understanding that current shaders are actually packaged as bytecode not in the Ages PRPs, but.. somewhere else? So can we add new ones, without forking the whole source?

This can be a big limitation in terms not just of visuals, but even of puzzle design, and overall Age design. Having a more flexible system here would be really useful.
User avatar
Aloys
 
Posts: 1946
Joined: Sun Oct 21, 2007 7:57 pm
Location: France (GMT +1)

Re: Custom Shaders?

Postby Sirius » Thu Apr 16, 2020 6:24 am

You're unfortunately right: it's simply not possible currently.

I haven't looked too much at Plasma's source, but from what little I saw and the PRP format itself... (anyone is free to correct me if I'm wrong):
Show Spoiler

That doesn't mean the PRP format couldn't be extended in the future to provide custom shaders, but for now you'll have to do with the plLayer stuff...

PlLayers can achieve some fairly decent results. I played with those extensively to make the sky in my Canyon Age, and some... *fun* things you can find in Myst V Ages when converted with Drizzle32 (has anyone ever found those ? :D ). But obviously, it's still fairly rigid and stupidly hard to control.

I would advise people making Ages to focus more on button pushing, instead of relying on custom materials and lighting effects :P
User avatar
Sirius
 
Posts: 1372
Joined: Mon Jul 26, 2010 4:46 am
Location: France

Re: Custom Shaders?

Postby Aloys » Thu Apr 16, 2020 6:45 am

Assembly?? Why? This is a *really* weird way of doing this, I don't see how this was a performance win, even in 2003.
Beside, at some point Cyan would have had to add new shaders, but I guess updating the executable was no problem for them. Still this is frustrating; it's like having an 8 bit palette for textures. :(

Don't tell me *you* wouldn't want to write custom shaders. :p
User avatar
Aloys
 
Posts: 1946
Joined: Sun Oct 21, 2007 7:57 pm
Location: France (GMT +1)

Re: Custom Shaders?

Postby Sirius » Thu Apr 16, 2020 7:37 am

Go figure ;) But hey, this was around 2000 ! To me it feels like the stone age - could you even write shaders in anything other than assembly at the time ? :lol: Engines have always tried their best to avoid having artists choke on actual shader code, and the workarounds at that time were... a bit strange when compared to our current standards (some engines offered only two or three different type of shaders, for instance). Maybe it was closer to how 3dsMax worked at the time, I have no idea. Compiling shaders takes some time too, might have weighted their decision in this direction :shrug:

Aloys wrote:Beside, at some point Cyan would have had to add new shaders, but I guess updating the executable was no problem for them.

Yep, and since the artists were in the same building as the programmers, that must have helped them a lot in figuring out how to setup some effects. But it's impressive to see how many Ages they built without using custom shaders (besides the waveset/grass/bubble ones).
That's probably why Uru/Myst V aged quite well for games that old. Artists at Cyan were good at using Plasma's lighting and multitexturing.

Aloys wrote:Don't tell me *you* wouldn't want to write custom shaders. :p

Don't twist the knife in the wound ! :lol: There isn't a single Unity project where I haven't written a custom shader, and I just love using grabpasses, alpha hashing, distortion, parallax, etc. But before that in Plasma, I have spent countless hours trying to understand how to design some materials/light effects. The result of all these weeks of accumulated knowledge can be summarized to this:
Show Spoiler

More seriously though. This is one of the reasons I had a big "Plasma ragequit" a while ago. Today I'm not against the idea of exporting one of my WIP Ages to Plasma should I ever finish one, but I know I'm going to be fairly limited. Not that you can't make a good-looking Age with Korman, but it's always going to be work due to the lack of accurate preview, among other things.

Aloys wrote:I don't see how this was a performance win, even in 2003.

I hope in the case of Plasma it was motivated by good reasons unknown to us. But then, people don't always take good decisions...
User avatar
Sirius
 
Posts: 1372
Joined: Mon Jul 26, 2010 4:46 am
Location: France

Re: Custom Shaders?

Postby Aloys » Thu Apr 16, 2020 8:44 am

Sirius wrote:Go figure ;) But hey, this was around 2000 ! To me it feels like the stone age - could you even write shaders in anything other than assembly at the time ?

That's actually a good point.. HLSL was introduced to D3D 9, in december 2002 according to Wikipedia; so Plasma predates that. First time I personally used shaders was with Quake 3 in 99, but that was mostly high level scripting, not true shader work.

Compiling shaders takes some time too, might have weighted their decision in this direction :shrug:

That's a good point too, today we can do that on the fly (although it's better to optimise that a compile them anyway), but back then I do guess on the fly shader compile time must have been bad.

in Plasma, I have spent countless hours trying to understand how to design some materials/light effects. The result of all these weeks of accumulated knowledge can be summarized to this:
Show Spoiler

:lol: Yah this is bad.. But then again, decent lighting and materials can be done in Uru; it's just not easy.

Not that you can't make a good-looking Age with Korman, but it's always going to be work due to the lack of accurate preview

This is the one thing I'd love to see improved in Korman. The export/test/modify workflow here is so time consuming.. Although, it is the hardest part of the toolset to improve right now.
(well, that and particles, but that's another topic entirely)

[edit] woops, messed up.
Last edited by Aloys on Thu Apr 16, 2020 11:07 am, edited 1 time in total.
User avatar
Aloys
 
Posts: 1946
Joined: Sun Oct 21, 2007 7:57 pm
Location: France (GMT +1)

Re: Custom Shaders?

Postby Tsar Hoikas » Thu Apr 16, 2020 8:55 am

Sirius wrote:Shaders were written by Cyan in assembly (not even HLSL ! this is madness !), and are stored in the executable.

This was how things were done at the time Plasma was written. Remember that the most recent Plasma's renderer is effectively a small upgrade from the DirectX 8 era renderer when shaders were... not exactly commonplace. I wasn't a programmer at the time, but from what I can tell, HLSL was introduced in DX9.

Sirius wrote: Plasma just guesses which fragment shader to use from the plLayer's properties. PlLayers can specify which vertex/fragment shader to use from a predefined list, but that list is very short and mostly just waveset shaders. So not much you can do with it. Besides, Korman doesn't support it, and I've never seen this used in any file.


The various modifiers such as plWaveSet7 and plGrassShaderMod attach the plShader to the layer at runtime. plWaveSet7 actually makes several layers, itself, so the material you give Plasma is mostly just a big dummy. There is nothing stopping you from attaching a shader at export time, however, if you can manage it. I'm not sure what exactly you expect to do with this though since you won't be able to adjust any of the shader parameters that way.

Sirius wrote:(Does that also mean Plasma materials are rendered in multiple passes ? This is not optimal, but well, it's not like it's a big deal anymore...)

In some situations...
Image
Tsar Hoikas
Councilor of Technical Direction
 
Posts: 2139
Joined: Fri Nov 16, 2007 9:45 pm
Location: South Georgia

Re: Custom Shaders?

Postby Sirius » Thu Apr 16, 2020 12:47 pm

Aloys wrote:But then again, decent lighting and materials can be done in Uru; it's just not easy.

Definitely my opinion too. Not easy, but doable :)
Personally I'm more reasonable than I used to. A few years back, I constantly thought "if Cyan can do it, so can I !". Now I know that this doesn't make things simple either; and usually it's better to focus on proper Age design, and rely on simpler materials. Simple to say, but it's taken me entirely too long to accept it :P


Aloys wrote:This is the one thing I'd love to see improved in Korman. The export/test/modify workflow here is so time consuming..

It's getting much better though. Exporting is relatively fast from what I can tell. I think at some point we'll also be able to export single pages, and keep the game running in the background so we can just /relink to see the changes.
Having everything else inside Blender (even Python compiling/packaging !) is really cool too. I'm glad I don't have to mess with .UOFs, PrpShop, AlcScript and PlasmaShop anymore.


Tsar Hoikas wrote:[...]the DirectX 8 era renderer when shaders were... not exactly commonplace.

Yeah, no surprise ! Game engines were less complex at the time, but they were just as hard to create given the limited hardware, software and documentation...

Oh well, Plasma is a bit like an old car. Don't expect it to go fast or have tons of options, but at least it came this far and it still works.
User avatar
Sirius
 
Posts: 1372
Joined: Mon Jul 26, 2010 4:46 am
Location: France

Re: Custom Shaders?

Postby Aloys » Thu Apr 16, 2020 2:58 pm

Sirius wrote:usually it's better to focus on proper Age design, and rely on simpler materials.

I agree, but when you are used to modern shader creations tools it's just so hard to go back.. :)

I think at some point we'll also be able to export single pages, and keep the game running in the background so we can just /relink to see the changes.

:!: That would be awesome! Quitting and reloading the whole game is a pain in the butt, and right now it's the single most time consuming part of testing Ages.

Game engines were less complex at the time, but they were just as hard to create given the limited hardware, software and documentation...

This is a discussion I often have with people new to game dev and I always have the same answer: it all depends on how demanding you are. Tools these days are infinitely better than 20 years ago, but on the other hand our expectations regarding games have increased too. Our expectations for a game in 2000 (real Myst) have nothing to do with today's expectations.. (Obduction) Sure today you could create a simple game in a matter of days that would have taken weeks or months back in 2000, but no one would consider it a modern game. So, in many ways we spend just as much time creating the games, but the final result has a higher level of quality and content.

The first game I worked on professionnally was in 2000, as an intern, it was an adventure game called Dracula 2 The Last Sanctuary in 'bubble-o-rama' like Exile. And while I look at it now with nostalgia and all I would never make the same kind of game today. :)
User avatar
Aloys
 
Posts: 1946
Joined: Sun Oct 21, 2007 7:57 pm
Location: France (GMT +1)


Return to Scripting

Who is online

Users browsing this forum: No registered users and 2 guests

cron