[ home / board list / faq / random / create / bans / search / manage / irc ] [ ]

/agdg/ - Amateur Game Development General

AGDG - The Board

Catalog

See 8chan's new software in development (discuss) (help out)
Name
Email
Subject
Comment *
File
* = required field[▶ Show post options & limits]
Confused? See the FAQ.
Embed
(replaces files and can be used instead)
Oekaki
Show oekaki applet
(replaces files and can be used instead)
Options
dicesidesmodifier
Password (For file and post deletion.)

Allowed file types:jpg, jpeg, gif, png, webm, mp4, swf, pdf
Max filesize is 8 MB.
Max image dimensions are 10000 x 10000.
You may upload 5 per post.


Welcome to AGDG, have you ever made a game?
See also: /ideaguy/ | /vm/

File: 1446848336993.jpg (654.9 KB, 1920x1200, 8:5, RainbowBeach.jpg)

555d05 No.23661

So how the hell do you do a rainbow in a 3D game enviroment?

2ac872 No.23662

Depends on what you're aiming for.

Consider a rainbow is only visible when your eyes is at a particular angle to a light source + theres water vapor.

Seems to me that a shader would be a good spot. I've done chromatic distortion based on an eye ray and intensity of a light source before, seems pretty straightforward to make a rainbow.

But, for performance, assuming its in the distance, it's just a billboard that doesnt rotate with the view direction.


388604 No.23664

put it on a transparent plane then add glow effects and maybe add some sort of function that adjusts opacity based on player distance.


69ca3e No.23666

File: 1446856220742.png (791.93 KB, 1200x796, 300:199, rainbow nutshell.png)

>>23664

>glow effect

*screen blending

You don't want it to "glow". You want it to screen blend in with whats behind it (as rainbows do).

The best way to test this is find a good photo of a rainbow, and try to replicate it in Photoshop. Blend modes are helpful for this experiment, because you can easily replicate them in graphics shaders.

The problem with glow effects, is that they often use additive blending, which will end up looking like a smudge of white mess (kinda like bloom, but way worse).

Additive blending does certainly achieve the whole (make stuff behind the rainbow appear brighter) look, but it also crushes the blended colors into white far too much. You don't want that, as you want your rainbow to be colorful yet retain its initial detail.

To achieve a good rainbow, get a vector of some colored lines and apply a Gaussian blur effect at around 2.5 pixels.

Then render it to a billboard with a shader performing screen blending, at about 60% opacity.

More information:

https://en.wikipedia.org/wiki/Blend_modes#Screen

http://elringus.me/blend-modes-in-unity/


c10f68 No.23668

File: 1446859183013.png (522.45 KB, 2048x2048, 1:1, rainbowblurred.png)

A rainbow is a static effect. You're best off just pre-baking it into an image and billboarding it, like >>23666 said, but emphasis on the prebaking

Something like pic-related would work well enough, and you could modify it to your needs.

>>23666

You still want to blend in a way that brightens a bit. Remember that rainbows, being light themselves, are additive by nature.


69ca3e No.23676

>>23668

You can achieve that through two methods that will have a better outcome than using straight up additive blending:

- Brighten the pre-baked source image slightly.

- Use the alpha channel of the pre-baked source image to brighten the final pixels after the screen blend is applied.

As long as either of these are a very subtle amount of brightening, it will have a far better outcome than regular additive blending.

Additive blending is way too OP when it comes to rainbows.

It's cool for particle effects though.


69ca3e No.23677

>>23668

Also I agree about rainbows being additive in nature.

I think the problem is that computers aren't a full representation of nature color wise. So additive, while technically correct, just goes way over the top. It's more like a bells and whistles kinda thing than the base blend mode you'd want to use.


c10f68 No.23678

>>23677

Well yes, I'm not saying it should be outright added; that wouldn't work without some HDR filtering. But it should brighten to some degree at the least.


c10f68 No.23679

Actually, now that I think about it, you could just add it if you have HDR available. It's pretty easy to implement in OpenGL and Direct3D, but I'm not sure what OP is using.




[Return][Go to top][Catalog][Post a Reply]
Delete Post [ ]
[]
[ home / board list / faq / random / create / bans / search / manage / irc ] [ ]