Hue Shift (like photoshop) Effect

Blitz3D Forums/Blitz3D Programming/Hue Shift (like photoshop) Effect

The forum is locked. These are the original blitzbasic.com forums, kept so they can still be read. No new topics, replies or edits can be made here. To join in, head over to the Blitz3D+ forums.

Hey Sswift, thanks for jumping in!

I'm afraid I'd already tried that approach and found that it didn't work either (though I suspect it's <more> right than the one that i posted). In fact, it looks identical to the HSL version that I posted based on jfk's suggestion.

I still don't understand what I can do to eliminate the intermediate stages where the colors add together to be too bright. Please let me know if you have any other ideas!

thanks again,
roland

here's a version of it based on that approach. It adds to the next color while the previous color is at 255, then decrements the previous color, etc. A 6-step approach instead of 3.


Graphics3D 640,480,0,2

pivot = CreatePivot()
cam = CreateCamera(pivot)
PositionEntity cam,0,0,30
PointEntity cam,pivot

Type col
	Field image
	Field red
	Field green
	Field blue
	Field state
End Type

Function makecol(file$,red,green,blue,state)
	c.col = New col
	c\image = LoadSprite(file)
	ScaleSprite c\image,20,20
	EntityFX c\image,1
	EntityBlend c\image,3

	c\red = red
	c\green = green
	c\blue = blue
	c\state = state
	
	EntityColor c\image,c\red,c\green,c\blue
	
End Function


makecol("red.jpg",255,0,0,1)
makecol("green.jpg",0,255,0,3)
makecol("blue.jpg",0,0,255,5)

speed = 10

While Not KeyHit(1)

	For c.col= Each col
	
		Select c\state
		
			Case 1
			c\green = c\green+speed
			If c\green>255 Then c\state = 2
			
			Case 2
			c\red = c\red-speed
			If c\red < 0  Then c\state = 3
			
			Case 3
			c\blue = c\blue+speed
			If c\blue > 255 Then c\state = 4
			
			Case 4
			c\green = c\green-speed
			If c\green < 0 Then c\state = 5	
			
			Case 5
			c\red = c\red+speed
			If c\red > 255 Then c\state = 6				

			Case 6
			c\blue = c\blue -speed
			If c\blue < 0 Then c\state = 1	
				
		
		End Select	
	
		EntityColor c\image,c\red,c\green,c\blue
	
		If c\red < 0 Then c\red = 0
		If c\green < 0 Then c\green = 0
		If c\blue < 0 Then c\blue = 0
	
	
	Next

RenderWorld()

c.col = First col

Text 0,0,c\red
Text 0,14,c\green
Text 0,28,c\blue

Text 0,50,c\red+c\green+c\blue

Flip

Wend