Luminance / wasm integration #443
Replies: 3 comments 8 replies
-
Hey @robert-chiniquy I'm messing with your example and I figured I'd share what I've found so far: BlendingSo I modified the fragment shader to always return solid red to debug the positions of the vertices and I discovered that with the current blending, the alpha of the UI is somehow wrong and ending up transparent even with solid, opaque colors. I copied the blending I used for Bevy Retro and it seemed to fix it, but I know nothing about premultiplied alpha or how that changes things so it may need tweaking to be conformant: let render_st = &RenderState::default()
.set_blending_separate(
Blending {
equation: Equation::Additive,
src: Factor::SrcAlpha,
dst: Factor::SrcAlphaComplement,
},
Blending {
equation: Equation::Additive,
src: Factor::SrcAlpha,
dst: Factor::SrcAlphaComplement,
},
)
// This is also needed ( explained below )
.set_depth_test(None); Depth and Vertext ColorsAs another experiment I tried setting the fragment color to the vertex color, completely ignoring the texture, to see what result that produced. I found out that it is necessary to set the depth test to After doing that, and still seeing nothing, I took out the linear-to-srgb step from the vertex color: // Old
// v_rgba = linear_from_srgba(a_srgba);
// New
v_rgba = a_srgba; Apparently there is some issue with that conversion because that yields: So at that point it seems basically working other than the texture. OtherFrom other messing around trying to get the texture to apply it seems like the texture might be 0% opaque, but I don't know for sure yet. Also, I'm not sure exactly what your use-case for egui on top of Luminance is, but you might be interested in the I'm not sure if I'll get to messing around more than I have already, but if you want to use |
Beta Was this translation helpful? Give feedback.
-
Just thought I would update with progress. Feels like I am getting close. Details in the README here: https://github.com/robert-chiniquy/display-pure-egui-texture Here's what I've got rendering with Luminance on the web now: |
Beta Was this translation helpful? Give feedback.
-
Ok, another question: I am normalizing the vertex colors here: https://github.com/robert-chiniquy/egui-luminance/blob/main/src/egui_luminance.rs#L44 so they can be assigned to a Looking at I'm not confident that normalization is the cause of my issue, but that seems like a big discrepancy. That issue is why Zicklag above took out the Any insight into that would be appreciated. |
Beta Was this translation helpful? Give feedback.
-
Hi!
I'm trying to get Egui drawing in Luminance in the browser. I thought this would be pretty easy since I can draw with Luminance, and Egui's API is perfect, just giving me the tesselation.
I have all the pieces together for rendering to happen (I think). I am getting no errors in the browser console. I followed all your tips here: https://github.com/emilk/egui#debugging-your-integration
What I'm observing is that the vertices are making it to the shaders, because if I change the blending function (or tweak the frag shader), I can make the area that my
egui::SidePanel::left("❤", 200.)
occupies change color, but by default it seems that it is white (the same as the pipeline clear color). So nothing is getting drawn, or, if it is, it is white, or it is being blended away.✔️ I've got the vertices, texture coords, and indices loaded and they look good, along with the color attribute
✔️ I've got my blending function set correctly (I think, I've tried a few different combinations there)
✔️ I'm using (with small modifications) the shaders from
egui_web
If anything stands out from the above, I would really appreciate any advice or guidance you can offer.
Thanks!
Edit to add: I pushed a sample repo if anyone would like to help: https://github.com/robert-chiniquy/egui-luminance
Beta Was this translation helpful? Give feedback.
All reactions