Product Chat / Shader Modification via LUA

Author
Message
Teabone
Forum Support
17
Years of Service
User Offline
Joined: 8th Jun 2006
Location: Earth
Posted: 26th Sep 2019 14:23
Hi everyone,

I recall there being an update where we could modify the values of a shader via LUA. What were those commands or variables? Additionally was there a way to shader swap via LUA? I'm not seeing anything in the global.lua?
Store Assets - Store Link

i7 -2600 CPU @ 3.40GHz - Windows 7 - 8GB RAM - Nivida GeForce GTX 960
Corno_1
GameGuru Tool Maker
13
Years of Service
User Offline
Joined: 3rd Nov 2010
Location:
Posted: 26th Sep 2019 14:43
The command is SetShaderVariable
How to use it:
https://forum.game-guru.com/thread/219463#msg2598720
https://forum.game-guru.com/thread/219792#msg2602101
Ebe Editor Free - Build your own EBE structures with easy and without editing any text files
Thread and Download
PM
Teabone
Forum Support
17
Years of Service
User Offline
Joined: 8th Jun 2006
Location: Earth
Posted: 28th Sep 2019 17:59
So for example if im looking to modify the color or alpha channel of an entity would this mean id be looking into variables inside entity_core.fx?
Store Assets - Store Link

i7 -2600 CPU @ 3.40GHz - Windows 7 - 8GB RAM - Nivida GeForce GTX 960
cybernescence
GameGuru Master
11
Years of Service
User Offline
Joined: 28th Jan 2013
Playing: Cogwheel Chronicles
Posted: 28th Sep 2019 20:36
Yes for items that use non pbr shaders. Otherwise apbr_core.fx for pbr.

Cheers.
Teabone
Forum Support
17
Years of Service
User Offline
Joined: 8th Jun 2006
Location: Earth
Posted: 3rd Oct 2019 01:57
hmm not sure where to begin. I'm looking to do two different things. One be able to control the alpha channel of an entity. Essentially make it be able to fade in and out. Another is being able to make an entity glow green and red similar to how they look in the editor when selected for static and dynamics.

What types of variables should i be looking out for?
Store Assets - Store Link

i7 -2600 CPU @ 3.40GHz - Windows 7 - 8GB RAM - Nivida GeForce GTX 960
cybernescence
GameGuru Master
11
Years of Service
User Offline
Joined: 28th Jan 2013
Playing: Cogwheel Chronicles
Posted: 3rd Oct 2019 07:14
The first idea is the easiest. If you look at the shader mod that I posted that fades the character alpha based on distance you will see how to modify the alpha/transparency. Then this needs to be tweaked using SetShaderVariable instead of the distance calc - so one of the four floats that is passed from lua to the shader is used to modify the alpha. This will give you lua control of the transparency of any and all entities using that shader.

The second objective needs some engine updates too as you are targeting a specific entity within a batch all using same shader. I can’t really describe this further here. But you’re correct you can coerce it work like the editor does when you hover over an item. The shader variable is GlowIntensity if you want to experiment with it.

Cheers.
Teabone
Forum Support
17
Years of Service
User Offline
Joined: 8th Jun 2006
Location: Earth
Posted: 6th Oct 2019 22:32
Quote: ". If you look at the shader mod that I posted that fades the character alpha based on distance you will see how to modify the alpha/transparency. "


:o where?
Store Assets - Store Link

i7 -2600 CPU @ 3.40GHz - Windows 7 - 8GB RAM - Nivida GeForce GTX 960
cybernescence
GameGuru Master
11
Years of Service
User Offline
Joined: 28th Jan 2013
Playing: Cogwheel Chronicles
Posted: 6th Oct 2019 23:12 Edited at: 6th Oct 2019 23:13

Login to post a reply

Server time is: 2024-05-19 23:03:00
Your offset time is: 2024-05-19 23:03:00