#Request: Shader API Exposure (Reflection-API-Dependent)

1 messages · Page 1 of 1 (latest)

haughty owl
#

I heard about the recent zero-day patch removing the powerful reflection API hooks for Lua in PZ. This has unfortunately completely disabled my advanced mod that took a year and a half and a several experiments that provides players with access to realtime loading, rendering and fully controlling shaders in PZ: ShadeHammer.

In order for this mod to work I need the following API:

Expose the following classes:

  • FBOTexture (OffscreenBuffer & Current in Core) & Grabbing the backing Texture field inside with a getter.

  • ShaderMap

  • skinnedmodel.ShaderProgram

  • opengl.ShaderProgram

  • zombie.iso.weather.WeatherShader

  • The ShaderProgram instances loaded in Singleton group object introduced in Build 42. (I used one barely exposed shader to gain access to all shaders so unless this was exposed I couldn't get anything)

  • Both skinnedmodel & opengl ShaderProgram objects passed through the LuaExposer.

  • The OpenGL-assigned program ID for the ShaderProgram.

  • The uniforms with their loc and type fields to map to Uniforms properly to modify.

The reason why I need the shader programs and their IDs is to use the exposed SpriteRenderer API to assign values and pass them to Uniforms in shaders. I can also create new shaders using:

--- @param name string
function ShadeHammer.wrapSkinnedShader(name)
    local model = loadZomboidModel('Dummy_Shader_Model_' .. name, 'Vehicles_Wheel_' .. name, 'Vehicles/vehicle_wheel',
    name, false);
    local shader = Reflect.getJavaFieldValue(model, 'Effect');
    local shaderName = Reflect.getJavaFieldValue(shader, 'name');
    print('discovered shader\'s name: '.. shaderName);
    return LuaShader:new(shader, shaderName);
end

All of this worked to make all of this possible:

#

(This uses reflection into the debug offset coordinates in the IsoCamera class and wouldn't work without access to this)

#

I spent over 500 hours' worth of free-time this past year and a half working on making this possible and was going to pick it back up. We'd be losing out on so much potential if this API couldn't be rerouted to public access in some fashion.

#

(For reference since it is in another mod)

#

But to help for reading any internal math code in the codebase if needed.