OpenGL ES flash of bright light - iphone

I'm having some trouble achieving my desired effect in an OpenGL ES app I'm working on. I can use OpenGL ES 1.1 or 2.0. What I'm trying to achieve is the following...
In a 2D ortho scene (black clear color), render a red square to the screen with some transparency so it is a darker red (or just set to darker red color). This is no problem for me. Then, when a user clicks in the region of the square, I want it to quickly flash in a bright flash of light (just in the region of the square). This flash doesn't have to persist long at all, just enough that if the user was in a completely dark room, this flash of light would create a brief noticeable flash in the users face. I've been having some trouble getting a "light bloom" or glow effect to work efficiently, and was wondering if anyone had ideas for a quick, efficient way to make the color flash brightly for a split second. Possibly through the use of some kind of texturing trick that I don't know of. Also, the flash doesn't have to blur outside of the region, it can be fully contained within the region with sharp edges. Really all I'm after is the aesthetic of the flash lighting the immediate area around the screen.

Disable texturing, glColor3ub(255,255,255), render square, wait a bit, redraw square normally.

Related

All shaders render black while using shadergraph in unity 2020 1.10f

I am doing a simple animation in unity and I wanted to add portal efecct using shadergraph 8.2.0 and everything renders black
like this
shader setings
I have no clue whatsoever what it is
I'm still learning the pipeline, however, I would think you need to scale up the texture on the top left, I can't read its name from the image. But you are getting the red/yellow mix, getting the swirl, but the area that's being blacked out is comparable to the texture I mentioned. Sorry I don't know how to put it exactly, but the white to grey to black gradient is not large enough so you are rendering the center fine just need to expand the white-grey area, I think scaling the texture up would produce the effect you want.

Unity: Any way to get anti-aliasing on Screen Space - Overlay Canvas?

I'm using Unity and I have a Screen Space - Overlay canvas and it has Image objects that rotate. The problem is that on shallow rotations the images have really obvious jagged edges. I can't find any built in anti-aliasing solution that fixes this.
I know the MSAA in the settings doesn't apply to overlay canvases, neither does the anti-aliasing in the Post Effects package.
I can't change to a Screen Space - Camera canvas, I know that will apply MSAA but it breaks my game in too many other ways to be viable (my game is almost finished, I left adding AA to the end which may have been a mistake).
Is there any way to get AA to work on an overlay canvas?
A possible solution is in the second answer in this question on Game Development Stack Exchange: add a transparent outline to your image.
Enabling mip-maps gets you half way there, but the other half of it is to make sure that sides you want smoothed are bordered by alpha transparency. The outer edge of everything you want smooth must be transparent.

Skybox affecting sprites

The default skybox affects the sprites colour. I'm not sure how to stop this from happening. You can see below that the outline of the sprite is brown instead of grey.
If I set the main camera clear flags and background to Solid colour & black respectively, the brown from the skybox still shows through.
I'm not sure what information would be useful for others to assist me with this, so if there is any info I can add, just let me know and I'll update accordingly.
What you're seeing here is alpha blending, your 'outline' pixels have low alpha, so when rendered Unity will blend their color with the background. It generally represents transparency, but in this case it's behaving as a kind of anti-aliasing (it makes your sprites look smoother and less pixely) In that sense, it's working as intended. Look at your sprites at normal resolution and you'll notice they should look good.
If you prefer the pixelated look and really don't want this behaviour, you need to edit your sprites to have full alpha on those pixels.
I'm not sure about Empty's answer:
Are you using the standard shader? That shader uses the environment map as an ambient color on top of the diffuse color (albedo). This is perfectly normal behaviour and makes colors of everything blend nicely with each other. (with an orange sky white objects will look onage-ish. ) This is part of "physically correct lighting" (PBL). It is not at all physically correct, but it comes close enough for now.
If you don't want the environment to affect the colro that mucha you could either alter the environment map to a less dramatic color (normal blue/white sky) or use an unlit shader/material.
Window->Rendering->Lighting Settings
Under Debug Settings, select Generate Lighting.
De-select Auto Generate.
From the Baked Lightmaps set Lighting Data Asset to None.
Remove generated Lighting from the project.

Unity Camera Target Texture Render Texture How To Get Masks To Work?

I'm looking at using Camera TartetTexture RenderTexture functionality for less processing intensive menu transitions but I'm having some trouble. Every texture I render out from the camera doesn't have masks working. I can see the whole version of every graphic on the screen. How can I get it rendering keeping the masks in tact? It is also failing to render any of my spawned prefabs. Either that or they could be hidden behind the unmasked graphics.
Also, I was told to render to a material. None of the shaders I've tried have supported the masks (don't know if that's really the problem) or have looked like the original image. They all look dark and moody, with the occasional weird alpha channel in the upper left corner. How can I get the image looking just like my screen?
My menus are all on a Screen Space - Overlay canvas, so they shouldn't need to be lit.

Unity3D - Make texture edges not stretch

I've been searching around for this one for a bit, and unfortunately I can't seem to find any good, consistent results. So, in the Unity UI system, buttons can stretch without becoming pixelated or distorted. This is because the texture is split up into 9 parts - the corners, middle, and sides.
This works because the button's middle and sides are stretched, but not the corners. Then, the button appears not pixelated, at any dimension.
So, the question is as follows: How can I do the same thing for a transparent, unlit texture in 3D space? I have a speech bubble texture on a flat plane that I know how to re-scale to fit the text in the speech bubble.
I've set the texture type to Multiple Sprite, and divided it up into 9 parts. However, I cannot seem to find where I can set the texture to act like the UI button does, and I'm not sure that this is even possible in this way in 3D space.
Is there a way, or should I just make the different parts of the texture different objects, and move them together? That would seem very inefficient and ugly compared to this.
To accomplish what you are asking, you would need to create tiles for this speech bubble and then write a script that procedurally builds a speech bubble based on the plane's scale value. You could also try just changing the texture's Filter Mode to Point.
However I really don't think you should be using textures for this anyway. Why not just use a Unity Canvas and set the Render Mode to World Space? Then you can just set your text box to be a sprite, not a texture, and set its filter mode to Point (See below). This would also make it a lot easier for when you want there to be text in the speech bubble later on.