devonium / EGSM

SHADERS FOR EVERYONE!!!! i have no idea wtf is going on
88 stars 3 forks source link

Possible to sample the entity's $color2? #6

Closed ZH-Hristov closed 1 year ago

ZH-Hristov commented 1 year ago

Just trying to modify the sobel operator shader to sample it's color from the one set by the color tool. I'm new to this HLSL stuff but it seems fun to play around with.

ttmso commented 1 year ago

i dont know of any way to do that but maybe devon knows

devonium commented 1 year ago
SetPixelShaderConstantFP(0, PARAM_COLOR2)
ZH-Hristov commented 1 year ago
SetPixelShaderConstantFP(0, PARAM_COLOR2)

Tried this but it doesn't seem to work, at least when editing the per object sobel operator shader. Coloring the ent with the tool didn't change anything, whether the constant was set to the SBColor param or a different one.

devonium commented 1 year ago

The color tool doesn't set $COLOR2 To get the color of entity, use

SetPixelShaderStandardConstant(PSREG_DIFFUSE_MODULATION, STDCONST_DIFFUSE_MODULATION)
devonium commented 1 year ago

You also need to include shader_constant_register_map.h so you can use PSREG_DIFFUSE_MODULATION in your shader code

ZH-Hristov commented 1 year ago

Thanks! That works great!

https://user-images.githubusercontent.com/7620140/223880408-233464e8-1b6a-4538-be78-7b7813afbba2.mp4