March 01, 2021, 10:56:55 PM

Author Topic: [bb] Control Brightness and Contrast by Howitzer [ 1+ years ago ]  (Read 488 times)

Offline BlitzBot

  • Jr. Member
  • **
  • Posts: 1
Title : Control Brightness and Contrast
Author : Howitzer
Posted : 1+ years ago

Description : When you make a level in a program such as Maplet or Cartography Shop, you will either have a washed out level or a dim level.  Here is one way to fix it.

This can be used in both 2d and 3d as long as it is set to full screen.


Code :
Code: BlitzBasic
  1. Print "             Low------High"
  2. Print "Brightness < 0   50   100 (high # =high brightness"
  3. Print "                          low # =low brightness)  "
  4. Print
  5. Print "Contrast   > 8   4    2   (low # =high contrast   "
  6. Print "                          high # =low contrast)   "
  7.  
  8. brit=Input("Brightness(0<100)   =")
  9. cont=Input("Contrast  (8>2)     =")
  10. If cont=0 Then cont=255; cannot divide by zero- sets contrast to default
  11. level$=Input$("Load Level (level.b3d)=")
  12.  
  13.  
  14. ; Starting 3d
  15. Graphics3D 800,600,0,1
  16. SetBuffer BackBuffer()
  17.  
  18.  
  19. ; ******************** *******************************************************
  20. ; * Gamma Controller * * cont=Contrast brit=Brightness (cont scale reversed) *
  21. ; ******************** *******************************************************
  22. For x=0 To 255                                                              ;*
  23. SetGamma x,x,x,(x+x/cont)+brit,(x+x/cont)+brit,(x+x/cont)+brit              ;*
  24. Next                                                                        ;*
  25. UpdateGamma                                                                 ;*
  26. ; ****************************************************************************
  27.  
  28.  
  29. ; Enviroment
  30. camera=CreateCamera()
  31. PositionEntity camera,0,0,0
  32. CameraRange camera,0.01,10000
  33.  
  34. LoadMesh level$
  35.  
  36. While Not KeyDown( 1 )
  37.  
  38. If KeyDown( 205 )=True Then TurnEntity camera,0,-1,0
  39. If KeyDown( 203 )=True Then TurnEntity camera,0,1,0
  40. If KeyDown( 200 )=True Then MoveEntity camera,0,0.05,0
  41. If KeyDown( 208 )=True Then MoveEntity camera,0,-0.05,0
  42. If KeyDown( 17 )=True Then MoveEntity camera,0,0,0.05
  43. If KeyDown( 31 )=True Then MoveEntity camera,0,0,-0.05
  44. If KeyDown( 32 )=True Then MoveEntity camera,0.05,0,0
  45. If KeyDown( 30 )=True Then MoveEntity camera,-0.05,0,0
  46.  
  47. UpdateWorld
  48. RenderWorld
  49. Flip
  50.  
  51. Wend
  52.  
  53. End


Comments : none...

 

SimplePortal 2.3.6 © 2008-2014, SimplePortal