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

Easy use of custom GLSL shaders for mappers #2

Closed
poVoq opened this issue Jun 17, 2013 · 12 comments
Closed

Easy use of custom GLSL shaders for mappers #2

poVoq opened this issue Jun 17, 2013 · 12 comments

Comments

@poVoq
Copy link

poVoq commented Jun 17, 2013

It seems like something like this is very close to being possible now that q3 shaders are parsed on the GPU and glsl shaders are read from the harddrive.

IMHO the best way would probably be if the q3 shader syntax was extended to allow inline GLSL code, or to allow for custom referencing of GLSL code in another file.

Ultimately an easy to use shader node system like used in UDK would be of course the greatest for mappers, but for now an easy to understand way of doing it through the q3 shader system would be great too.

One use could be for example to make an custom shader that takes world normals and dust maps to calculate a direction based snow-cover on textures and map-models, or to add heat-disortion to a flame effect etc.

I hope this made sense and can be added to the engine.

Edit: There seems to be some work on-going to allow for something like that in ioQuake3 (see OpenArena forums), so maybe it would make sense to make a compatible system in qfusion.

@viciious
Copy link
Collaborator

I've never quite liked the idea of embedding vertex and fragment programs into shaders. Three points:

  • first of all, q3a shaders are an example of declarative programming, I don't want them to turn into what they are not to be: imperative programs, that is
  • artists and mappers are usually ridiculously bad at shaders and GLSL for whatever reasons. Either they can't be bothered or just lazy.
  • I want to keep shaders *LSL-agnostic, so I wiill still have the liberty of switching the renderer to DirectX/HLSL if I want to.

@poVoq
Copy link
Author

poVoq commented Jun 18, 2013

Ok, I get what you mean. But imho the reason artists and mappers are so bad at shaders is that nearly all engines make it damn hard to play around with them (e.g. you will hardly ever find an artist writing a shader from scratch, but adapting an existing on is well within reach) and that only a few have a nice node-based editor for them. However the real advances in the look of a game come when artists actually are able to mess with the shaders, as for example seen with the UDK.

Thus it would be great if you could come up with some way of allowing artists to make custom shader materials. Maybe there could be an way of simply declaring a custom GLSL function in the q3 shader, aka similar to this:
http://openarena.wikia.com/wiki/GLSL#On_to_using_GLSL_programs_within_the_Q3_shader_files
http://openarena.ws/board/index.php?topic=4767.0
?

P.S.: Both Blender and jmonkey3 have now node-based shader editors since very recently and allow for exporting the GLSL code, so it is more likely that an artist will come up with custom GLSL code now.

@viciious
Copy link
Collaborator

In my opinion current syntax for materials is more than adequate ana allows
sufficient customization. I do not quite like the OA approach.

2013/6/18 poVoq notifications@github.com

Ok, I get what you mean. But imho the reason artists and mappers are so
bad at shaders is that nearly all engines make it damn hard to play around
with them (e.g. you will hardly ever find an artist writing a shader from
scratch, but adapting an existing on is well within reach) and that only a
few have a nice node-based editor for them. However the real advances in
the look of a game come when artists actually are able to mess with the
shaders, as for example seen with the UDK.

Thus it would be great if you could come up with some way of allowing
artists to make custom shader materials. Maybe there could be an way of
simply declaring a custom GLSL function in the q3 shader, aka similar to
this:

http://openarena.wikia.com/wiki/GLSL#On_to_using_GLSL_programs_within_the_Q3_shader_files
http://openarena.ws/board/index.php?topic=4767.0
?

P.S.: Both Blender and jmonkey3 have now node-based shader editors since
very recently and allow for exporting the GLSL code, so it is more likely
that an artist will come up with custom GLSL code now.


Reply to this email directly or view it on GitHubhttps://github.com/viciious/qfusion/issues/2#issuecomment-19614076
.

Best regards,
Victor Luchitz

@poVoq
Copy link
Author

poVoq commented Jun 18, 2013

hmm, ok. But how would I as a artist/mapper and semi illiterate coder implement something like this for level custom textures:
http://www.zspline.net/blog/deposit-shader-in-mentalmill/
Which is easily doable in UDK without touching the engine code (see here: http://youtu.be/lH6SIFQ0ROE )
and perfectly feasible as something an artist should be able to do by himself?

@viciious
Copy link
Collaborator

Ummm, just use the 'material' keyword + snow texture as decal parameter or
another material pass?

2013/6/18 poVoq notifications@github.com

hmm, ok. But how would I as a artist/mapper and semi illiterate coder
implement something like this for level custom textures:
http://www.zspline.net/blog/deposit-shader-in-mentalmill/
Which is easily doable in UDK without touching the engine code (see here:
http://youtu.be/lH6SIFQ0ROE )
and perfectly feasible as something an artist should be able to do by
himself?


Reply to this email directly or view it on GitHubhttps://github.com/viciious/qfusion/issues/2#issuecomment-19617685
.

Best regards,
Victor Luchitz

@poVoq
Copy link
Author

poVoq commented Jun 18, 2013

Ok I looked up the "material" keyword and it seems to me that that is just the regular diffuse/normal/gloss shader used on all surfaces. There is no way this could be combined with a snow decal texture to get the same effect (which is based on taking the world normals and the hight channel of the normal-map to calculate the pixels on the texture that get covered with the snow texture for each in game surface individually).

However do you mean with "or another material pass" that is is possible to easily add another "material" like keyword, lets say "snowmaterial" that loads another custom GLSL shader and applies it to only to the textures with have this keyword in their q3 like shader? However if this case is true, that what would be the big difference to the OA implementation?

Sorry if I seem a bit dense in this regards... I am still struggling to understand all that GLSL shader stuff (and I am more of an artist than a coder).

@viciious
Copy link
Collaborator

No, that means you can layer materials like this:

{
material xxxx
}
{
material yyyy
}

But ye, you're right, one can't do per-pixel effects such as reading from
normalmap's alpha channel in the q3a shader. And it'll remain this way for
the foreseeable future.

2013/6/19 poVoq notifications@github.com

Ok I looked up the "material" keyword and it seems to me that that is just
the regular diffuse/normal/gloss shader used on all surfaces. There is no
way this could be combined with a snow decal texture to get the same effect
(which is based on taking the world normals and the hight channel of the
normal-map to calculate the pixels on the texture that get covered with the
snow texture for each in game surface individually).

However do you mean with "or another material pass" that is is possible to
easily add another "material" like keyword, lets say "snowmaterial" that
loads another custom GLSL shader and applies it to only to the textures
with have this keyword in their q3 like shader? However if this case is
true, that what would be the big difference to the OA implementation?

Sorry if I seem a bit dense in this regards... I am still struggling to
understand all that GLSL shader stuff (and I am more of an artist than a
coder).


Reply to this email directly or view it on GitHubhttps://github.com/viciious/qfusion/issues/2#issuecomment-19643983
.

Best regards,
Victor Luchitz

@poVoq
Copy link
Author

poVoq commented Jun 19, 2013

You seem to be avoiding to answer my actual question ;)
Is there an easy way for mappers to make custom per-pixel GLSL materials and load them via the build in q3 shaders?

@viciious
Copy link
Collaborator

No, and I said, it's going to stay this way for the foreseeable future.

2013/6/19 poVoq notifications@github.com

You seem to be avoiding to answer my actual question ;)
Is there an easy way for mappers to make custom per-pixel GLSL materials
and load them via the build in q3 shaders?


Reply to this email directly or view it on GitHubhttps://github.com/viciious/qfusion/issues/2#issuecomment-19685828
.

Best regards,
Victor Luchitz

@poVoq
Copy link
Author

poVoq commented Jun 19, 2013

Ok, thanks for the clear answer. Really a pity though.

@poVoq poVoq closed this as completed Jun 19, 2013
@viciious
Copy link
Collaborator

I'll reopen this issue when I think I've come up with a good idea for
implementation of your feature.

2013/6/19 poVoq notifications@github.com

Ok, thanks for the clear answer. Really a pity though.


Reply to this email directly or view it on GitHubhttps://github.com/viciious/qfusion/issues/2#issuecomment-19708383
.

Best regards,
Victor Luchitz

@poVoq
Copy link
Author

poVoq commented Jul 14, 2013

Maybe this kind of system could be duplicated:
https://github.com/blackberry/GamePlay/wiki/Materials-and-Shaders

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

No branches or pull requests

2 participants