3D Graphics Filter/Effect
Blitz3D Forums/Blitz3D Programming/3D Graphics Filter/Effect
| ||
I wonder if theres a way to turn a full color world into black and white using a effect filter? Any ideas? I'm stumped, and presumed imposible. |
| ||
Unfortunately not. We have tried it without success. The problem is, you cannot replace a color with the gamma correcture commands. red remains red and blue remains blue, xou can only reduce the amount of R,G and B, which results in the original colors down to black. but you couldn't swap red and blue to neutralize it etc. What you could do is: track down all objects textures (as described in "SaveB3D" ,code archives), then load the textures as images, convert them to BW, temporarly save them using savebuffer, load them as brushes and replace the original brushes with these (assign these brushes to the surfaces). And of course use no colored lights. And no colored Entitycolor (other than greyscale stuff). |
| ||
i'd just use Grayscale textures... Theres this game called ,..... Death illustrated (in Beta), that does that. Its cool. It Must be possible though! An non-Realtime method of course would just be reading and rewriting colour values on the screen.... It would be brilliant if that was effectively fast... |
| ||
Replace the t.jpg with your own pic. Uses Dot3 blending for a fake b&w effect. Dot3 blending isn't supported by ALL hardware remember! Also, my Quad in front of the camera probably isn't perfectly placed :) But it'll do for this demo! Graphics3D 800,600,32,2 ClearTextureFilters campiv=CreatePivot() cam=CreateCamera(campiv) bwcam=CreateCamera(campiv) CameraViewport bwcam,0,0,512,512 light=CreateLight(2) PositionEntity light,1,4,-20 quad=CreateMesh() EntityFX quad,1 surf=CreateSurface(quad) qx#=1 qy#=1 v1=AddVertex(surf,-qx,-qy,0,0,1) v2=AddVertex(surf,-qx,qy,0,0,0) v3=AddVertex(surf,qx,qy,0,1,0) v4=AddVertex(surf,qx,-qy,0,1,1) AddTriangle(surf,v1,v2,v3) AddTriangle(surf,v1,v3,v4) PositionEntity quad,0,0,1 EntityParent quad,cam bwtexDot=CreateTexture(512,512,1) ; Dot3 TextureBlend bwtexDot,4 bwtex=CreateTexture(512,512,1) ; Quad Color (backbuffer gets copied to this) dr=127 dg=127 db=255 EntityTexture quad,bwtexDot,0,1 EntityTexture quad,bwtex,0,0 SetDot3Color(bwtexDot,dr,dg,db) cube=CreateCube() MoveEntity cube,0,0,5 cubetex=LoadTexture("d:\t.jpg",1) EntityTexture cube,cubetex doDot=False While Not KeyHit(1) TurnEntity cube,.2,.2,0 If KeyHit(57) doDot=Not doDot End If If KeyDown(71) dr=dr-1 SetDot3Color(bwtexDot,dr,dg,db) Else If KeyDown(72) dr=dr+1 SetDot3Color(bwtexDot,dr,dg,db) End If If KeyDown(75) dg=dg-1 SetDot3Color(bwtexDot,dr,dg,db) Else If KeyDown(76) dg=dg+1 SetDot3Color(bwtexDot,dr,dg,db) End If If KeyDown(79) db=db-1 SetDot3Color(bwtexDot,dr,dg,db) Else If KeyDown(80) db=db+1 SetDot3Color(bwtexDot,dr,dg,db) End If If doDot HideEntity cam HideEntity quad ShowEntity bwcam ShowEntity cube RenderWorld CopyRect 0,0,512,512,0,0,BackBuffer(),TextureBuffer(bwtex) ShowEntity quad ShowEntity cam HideEntity bwcam HideEntity cube RenderWorld Else HideEntity quad ShowEntity cam HideEntity bwcam ShowEntity cube RenderWorld End If Color 255,255,255 Text 0,0,"Press Space to toggle Dot3" Text 0,20,"Use Keypad: 7-8, 4-5, 1-2 to adjust Dot3 color and tweak effect" Text 0,40,"Dot Red: "+dr Text 0,50,"Dot Grn: "+dg Text 0,60,"Dot Blu: "+db Flip Wend End Function SetDot3Color(tex,r,g,b) SetBuffer TextureBuffer(tex) Color r,g,b ; experiment with these values Rect 0,0,512,512,True SetBuffer BackBuffer() End Function |
| ||
Try it with negative lights: Lights that have colors from 0 to -255 ( yeah it works :) ), this will perhaps help you create B&W graphics. A looong time ago there were some of this demos, think they can still be found at blitzcoder.com |
| ||
Wow, that Dot3 thingy is pretty cool, but does it slow down with more object. Like when running a game at 20000+ Triangles Rendered? |
| ||
Negative lights create some cool visual effects, but not black and white graphics. The black and white negative light demos were using black and white textures on the objects. |
| ||
I wrote a monochrome filter, only problem is that it drasticly lowers your fps. :'( |
| ||
I put a demo up once, but everybody said it wasn't what they were after. |
| ||
Wow Tom, I didn't know it's possible with dot3! Phil, I think I remember your demo used greyscale textures too, right? well that's basicly the same as I suggested, but I guess the real challenge is to switch any scene to BW, no matter what. This ay you could of course also do a lot of other FX like Nightvision, Termovision etc. But, of course, it would be better to save the BW Versions of the textures once and for all and then reuse the saved version. |
| ||
I'm pretty sure the idea come from when I set a texture to Dot3 blending in Gile[s], it showed as black & white in the viewport. The dot3 texture needn't be 512 res neither, 8x8 will do though I don't think it'll speed it up any (?) Time for some ZZzs! |
| ||
yeah jfk, you remember right :-) It was a mixture of textures blending to greyscale and a light calculation routine. The lights and textures all faded to grey in sync. The lights also faded to an average of it's rgb value to keep lighting consistant. |
| ||
ok, i'm pretty stupid when it comes to b3d but in 3dsmax i would make it mono by rendering to a img buffer then setting each pixels rgb to be the same ie img.g = img.r img.b = img.r this gives a nice mono effect not sure how fast it'd be on b3d tho |