Hi! I’m making a whiteboard for my VR project and I want user to be able to draw black. Since Blend Mode of my brush is set to “Additive”, black color does nothing. Also I want user to be able to wipe the board. Any ideas how can I achive that? I attached 3 images: 1) Whiteboard; 2) Whiteboard’s material; 3) Pen’s material.
I have BP_Pen that creates M_Brush instance and draws material to RenderTarget and that RenderTarget is used in whiteboard’s material.
Any reason in particular why you are using additive and not the default?
Default will erase everything that was drawn before. So I only will be able to draw a point
Understood. Also forgot to ask: Any reason that the "Draw"in the whiteboard is going to the emissive? Couldn’t go with a Lerp on the Base color?(maybe desaturate and power the drawing to create the mask?
I wanted my whiteboard to look like whiteboard (1st img). That’s why I added some reflections and pure white is going to the base. I could plug in RenderTarget to the base and set RenderTarget’s clear color to be (1,1,1) and get the same result but the problem with that approach is that I won’t be able to draw anymore because Brush is ‘Additive’. I hope I answered your question
Just a thought, might be stupid: what if you make black not [0,0,0], but [-1,-1,-1]? You can’t make it in color picker, obviously, but you can set it manually in the 3vector details.
For Black color painting, why not go for Blend Mode Modulate? It’s not compatible with dynamic lighting, but Blend Mode Additive isn’t either.
As colors are multiplied, for a white background this should even be ok with other paint colors.
What if I want to draw gray on top of gray? (0.5, 0.5, 0.5) * (0.5, 0.5, 0.5) = (0.25, 0.25, 0.25). Next frame (0.25, 0.25, 0.25) * (0.5, 0.5, 0.5) and so on. In the end, color will turn black
multiply sight got removed) 0.5, 0.5, 0.5) x (0.5, 0.5, 0.5) = (0.25, 0.25, 0.25). Next frame (0.25, 0.25, 0.25) x (0.5, 0.5, 0.5)
Already tried. Unfortunately it didn’t work
Tried. Doesn’t work. Or mb I’m doing smth wrong. After I move it a liitle bit, it breaks. Images attached. All done in simulation mode.
I’m working on something similar. I think the answers you are looking for are here:
https://www.youtube.com/watch?time_continue=645&v=TVZS7BHSEkY&feature=emb_logoThanks!
I used another appoach that allowed me to wipe the board. Can’t draw black though.
I used the same whiteboard material as shown above but instade of pluging in the RenderTarget, I used Canvas Render Target. So in this case I don’t use M_Brush material at all. For drawing circle I use “Draw Polygon”. Plane in BP is just a whiteboard’s “screen”. “Screen size” input is just draw size, should rename)
I watched the above mentioned video, and this seems to provide the solution regarding the “drawing black” issue. What basically happens is, that instead of drawing the final color into the rendertarget, just draw a single color and then lerp between white and a draw color in the whiteboard material so that the “additive” stuff never meets black.
I did a quick and dirty test, extending this to be able to select colors, doing it randomly in my BP for testing:
In the brush material, have a color as you did, this is now just a Color Selector, so a basically a mask gets painted into the render target.
In the whiteboard material, the rendertarget is just scanned and colors are lerped in.
In the whiteboard blueprint, here’s just a simple random selection done, quick and dirty.
The result
Just as some option to test with. The number of colors is limited (could maybe extended by using 2 rendertargets), also the order of colors is fixed, last in chain wins. But maybe it is helpful.
Finally made it. I’m able to draw black and erase the drawings. Thansk to herb64, FunAndFriendly and Oluap Olinad!
First of all, use Canvas Render Target and set its clear color to (0,0,0,1). M_Brush material stays the same. M_Whiteboard changes a bit, Param is Canvas Render targer. Since 1-x node is used in the M_Whiteboard, for drawing black brush color needs to be set to (1,1,1), for drawing red (0, 1, 1) instead of (1, 0, 0). Basically, set inverted values of color you wanna draw. For drawing I’m calling a function called “Draw”. For erasing I’m using a function called “Draw box” (see attachments). Set eraser’s color to be (0,0,0). In my case, I don’t need to set that color in M_Brush material because I’m not drawing material. I’m just passing it as a parameter when drawing a box.
Blend Mode Modulate works for me!