Tint the camera screen a colour?

Blitz3D Forums/Blitz3D Beginners Area/Tint the camera screen a colour?

Kippykip(Posted 2013) [#1]
I like making 3d movies with blitz3d :D
but In my latest one, I want it to tint the screen red as the character is getting angry
any ideas?


xlsior(Posted 2013) [#2]
Overlay the entire screen by placing a transparent red rectangle close to the camera?


Kippykip(Posted 2013) [#3]
is there a command? like cameraColor(255,0,0,#alpha)?
or something?


RemiD(Posted 2013) [#4]
You can create a quad or use a cube and scale it so it is flat, then you position this quad just in front of the camera, you color it with a red color (255,000,000) and you set it as a child of the camera so it will move/turn with it.
Then when you don't need it you can hide it with HideEntity(QuadMesh)
And when you need it you can show it with ShowEntity(QuadMesh)
Or
You can use EntityAlpha(Mesh,AlphaValue#) to make it progressivly visible or invisible.


Kippykip(Posted 2013) [#5]
Ok I'll do that then
thanks :D


Kryzon(Posted 2013) [#6]
I've been looking at the blend formulas used for this.
Alpha blending\transparency would take away detail, as you'd be replacing an entire color value for another (all colors, including dark ones, would be averaged to red).

The red tinting is better achieved with a Multiply blend mode, which can preserve luminosity (dark stuff remains dark).
Multiply works independently for each channel:

Rr = ( ( Rn / 255.0 ) * ( Ro / 255.0 ) ) * 255.0
Gr = ( ( Gn / 255.0 ) * ( Go / 255.0 ) ) * 255.0
Br = ( ( Bn / 255.0 ) * ( Bo / 255.0 ) ) * 255.0

You keep the filter's red color at 255 always, so the math above works out the resulting "Rr" red to be the same value as in the scene - no changes whatsoever.
However, you color the filter's green and blue channels to be something between 255 ~ 0, so the color in these channels is removed. The values you use for the green and blue channels allow for some control over how much filtering you want.
You could also have a green-only or blue-only filter with the same logic.

Here's a sample:






Kippykip(Posted 2013) [#7]
I ended up just changing the sky colour instead but WOW your pro at blitz basic!




Kryzon(Posted 2013) [#8]
Oh, well, someone else might use it later on. It's no problem :)

I saw your video before. Great work man, how did you animate that? I found the camera work very interesting.
It's a vast improvement over that first logo test you did a while ago, so we can expect some great stuff coming from you next.
(and that moon's from Majora's Mask if I'm not mistaken heh)


Kippykip(Posted 2013) [#9]
Thank you very much that means a lot to me :D
yes it is the moon from majoras mask xD

I made a debug mode (if debug = 1) is where I can move around, take screenshots, tilt the camera and it says the coordinates on the top of the screen etc

Example below
[bbcode]
Else
;Main movie here
timer = timer + 1
If(timer = 1)
HideEntity(sm1)
HideEntity(sm2)
HideEntity(moonman)
PlaySound music1
EndIf
If(timer < 190)
MoveEntity smintrowalk, 0, 0, -0.05
MoveEntity car, 0, 0, -1
yaw = yaw - 0.14
EndIf
[/bbcode]
that's from the start when the guy is walking and the camera is turning while car driving in the background
maybe this may help someone too :)


Kryzon(Posted 2013) [#10]
Wow, you're doing it straight through code. That's very brave.

If you're looking for an easier way to make your movies, you should consider learning Blender3D and exporting your movie scenes as animated 3DS's.
This format can be loaded in Blitz3D and supports hierarchical-animation (it's a way to call the kind of animation you're doing).
With Blender3D you'd build movies much faster and with better quality, even.

Since the 3DS format doesn't support lights or cameras (that is, you can have lights and a camera in your Blender3D scene, but the moment you load this scene in Blitz3D they won't be there anymore), there's a trick you can do to position and\or animate objects as placeholders for them:

• If you want to create light placeholders, you can create Blender3D light objects and light your scene as usual. When you're ready to export your scene, create a cube per light and position it aligned with the light - the cubes, being geometry, will be exported at each of lights' positions. Back in Blitz3D you load your movie scene, read all "light placeholder" cube entities, position equivalent blitz3d lights at them and free these cubes (you don't need them anymore after having the blitz3d lights take their place).

• If you want to animate a camera, create a Blender3D camera object and animate it for your movie as usual. When you're ready to export the scene, align a cube with this camera at the camera's first frame of animation, then copy every single of the camera's animation keys to the cube and export the scene - the cube, being geometry again, will be exported as a placeholder for that blender3d camera. Back in Blitz3D you can hide this "camera cube" entity, parent and position your regular blitz3d camera to it and have the camera inherit the original animation, since it's attached to the hidden animated cube.
Take notice that Blitz3D's cameras have a 90 degree field-of-view; this means you have to make sure you're using a Blender3D camera with this same 90 degree FOV (you can change it in the camera's settings) - if you don't, you will have mismatching framings.

It sounds more complicated than it is, honest!


Kippykip(Posted 2013) [#11]
Lol i'm stuck to blitz3d, just the perfect game making program for me
it's similar to multimedia fusion 2, I never realized that i've played blitz3d games until just recently (goofy gokarts, runrabbitrun) and eventually found out how to make models so I replaced the goofy gokart models with stickfigures I made

You can find some stickfigures I still use today in that video
In order for me to learn how to replace models for those games, I had to learn .b3d files so then I found out milkshape and fragmotion (fragmotion is what I used to figure out what frames do what in goofy gokarts)
but yeah VERY long story and had fun
also I've always had blender on my pc, but I never knew how to use it :P
I find it much easier to do it in blitz3d and make models and animations in milkshape 3d etc xD

Also I record with fraps, and export with camtasia (to reduce file size because fraps make a 30 video like 1GB)

Maybe one day I'll figure out blender, just to complicated for now xD


RemiD(Posted 2013) [#12]

I want it to tint the screen red as the character is getting angry
any ideas?


Kippykip>>
Here is my try at it :
http://blitzbasic.com/codearcs/codearcs.php?code=3022


Kippykip(Posted 2013) [#13]
Thanks remi, that will help in my game :D


K(Posted 2013) [#14]
SetGamma() ?

I do vids in code, usually. Fine-tuning I do say leads to laborious-ness.
I would say worse than stop-motion if you're in the wrong mind-frame.


Kryzon(Posted 2013) [#15]
SetGamma works great, but it's only available with fullscreen graphic modes.


K(Posted 2013) [#16]
Ah, true that. But for this video capture I assumed fullscreen.

As a side note, playing with Gammas not looking for a specific result can give fascinating results. Just making different algorithms, you can get some fascinating false-colour effects.


Kryzon(Posted 2013) [#17]
What videos do you do?


Kippykip(Posted 2013) [#18]
Whatever pops up in my head, or requests


Kryzon(Posted 2013) [#19]
That was directed at K, lol. He said, "I do vids in code, usually."

I've seen your video already :)


K(Posted 2013) [#20]
Used to do some claymation etc. for fun. Now cutscenes for my game. Keeping camera work subtle requires such tinkering.
I considered and still do making a gritty cartoon with b3d.

Adios, and such. Tomorrow morning I depart from the internet. I enjoyed my stay here. This community has a rare... niceness not found elsewhere (often not in real life). This place has educated me... I have no computer training so I needed you guys. Thanks again for fixing that func Kryzon, I give props.
-K

PS. Oh yeah,on earlier thread of 'why () after mousex etc...?' the reason is that funcs demanded to return values specifically require (). Works the same for customs...
My_func x,y,z ; Works
n=My_func(x,y,z);Works
My_func(x,y,z);Works,but returned value goes nowhere


Kryzon(Posted 2013) [#21]
Why go away? The Internet is a tool; if you go to it without any clear goal you're just gonna spend time and not get anything done...

You have to use it in your favor.


Axel Wheeler(Posted 2013) [#22]
Kryzon,

Awesome tint code! I will use this, if it's ok? I presume it is, or you wouldn't have posted it.

K,

I like putting () after all functions because it's the norm in most of the programming world, so why not be consistent?

Don't go away! You're valuable here!


Kryzon(Posted 2013) [#23]
@Axel: use as you please, pub domain.

The bulk of the effect comes from the way the API blends textures, so you'll be able to reproduce this in any other OpenGL or Direct3D engine - just have to make sure you get the fullscreen quad and coloring working as supposed.


Kippykip(Posted 2013) [#24]
Kryzon said

Oh, well, someone else might use it later on. It's no problem :)
I saw your video before. Great work man, how did you animate that? I found the camera work very interesting.
It's a vast improvement over that first logo test you did a while ago, so we can expect some great stuff coming from you next.
(and that moon's from Majora's Mask if I'm not mistaken heh)


I made my first finished game in blitz3d :D
please take a look Kryzon :D
http://www.blitzbasic.com/Community/posts.php?topic=99949#1176608