Open AvengerDr opened 7 years ago
I have made another test, finding more weirdness.
In the above picture, the two objects have the same material, however I have attached a Startup Script where in the Start method I have
public override void Start()
{
var material = Entity.Get<ModelComponent>().Materials[0];
material.Parameters.Set(EdgeGlowKeys.EmissiveColor, material.Parameters.Get(MaterialKeys.DiffuseValue));
}
They each have a different colour set as a Diffuse value, the plane is set to dark green, and the cube to purple. Somehow, the cube glows, the plane doesn't.
If I set both diffuse values to purple (in the material properties from the Game Studio), both objects stop glowing - same two object, same shader, same script, just two different Color4
values:
Hope this helps.
Thanks for investigating further! I can't seem to reproduce either issue. Could you maybe upload a small reproduction sample?
Hi, did you already try the project I linked in my first post? I had also linked the VS debug log.
To take the other pictures I made a small change to the "EdgeGlow.xksl" file contained in the reproduction project. I basically added a cbuffer (quoting from memory):
cbuffer PerMaterial
{
[Color] stage float4 EmissiveColor = float4(1,0,1,1);
}
then I changed the float4
constant initialization hardcoded in the shader method (further down) to reference EmissiveColor
.
and then added that script (with the Start method) to a plane and a cube. Then I set two different colour values for the DiffuseMap.
On a side note, it looks like that if I don't include that variable EmissiveColor
in a cbuffer
it doesn't seem to get picked up by Xenko (I mean if I just declare it as a field, outside of any cbuffers
). If I set it like in the script, and even though it has a default value in the actual shader code, it seems to stay black. Putting it in a cbuffer
seems to make it work.
Anyway let me know if that project I linked reproduces the error, otherwise when I get back home I'll upload a version with this change I made.
Thanks in advance.
I missed the link to the sample, sorry! Could you upload it somewhere else anyway? I can't seem to download it from that site.
Try this dropbox link.
Thanks! Your custom shader seems to output negative colors where there is no glow. This will will break some post effects/swallow light. Clamping colors will fix it:
override float4 Compute()
{
...
return max(0, CalculateColor(tx));
}
Hi, this is related to this forum post I made a while ago. With the release of 1.9(.1) I had the chance to look into it a bit more in depth.
The cube (seen frontally) has an emissive shader. We should see it glowing all around. However, the bottom half is not glowing. The ground plane has the same material applied to it and that seems to be the cause of the lack of glow. The top half is instead glowing against the clear render frame color (set to a dark gray to show the contrast).
Using VS' graphics debugger it seems the Bloom algorithm is working as it should:
However the problems seems to happen in the compositing stage:
Perhaps something that has to do with that pixel shader? The blurred picture looks like it has an alpha value of ~= 0.5 all around. The final composite image (the one half blurred, half not) has an alpha of 1. I'd appreciate if you could have a look at the pixel shader involved.
I have been able to create this repo project where you can see the issue. There is also the vsglog file if you want to have a look.