Anyone done a Night Vision Goggle effect ?

Help and techniques for creating Air Manager Instrument Graphics

Moderators: russ, Ralph

Post Reply
Message
Author
Roxus
Posts: 58
Joined: Wed Sep 02, 2020 7:30 pm

Anyone done a Night Vision Goggle effect ?

#1 Post by Roxus »

I'd like to replicate the XP11 Night Vision effect on AM and was wondering if its already been done ?

I'm thinking something like a transparent panel over top of the existing one with a fullscreen "green image" that I will vary the opacity on, randomly ?
I think also I might either rotate the image 180deg every 10ms to get the effect of the speckles moving, or change the visibility on a few similar images in order to get that effect ?

But any input or ideas, would be appreciated

User avatar
Keith Baxter
Posts: 4671
Joined: Wed Dec 20, 2017 11:00 am
Location: Botswana

Re: Anyone done a Night Vision Goggle effect ?

#2 Post by Keith Baxter »

Roxus wrote: Wed Sep 23, 2020 4:21 pm I'd like to replicate the XP11 Night Vision effect on AM and was wondering if its already been done ?

I'm thinking something like a transparent panel over top of the existing one with a fullscreen "green image" that I will vary the opacity on, randomly ?
I think also I might either rotate the image 180deg every 10ms to get the effect of the speckles moving, or change the visibility on a few similar images in order to get that effect ?

But any input or ideas, would be appreciated
Hi, we are very close to that.
Just some fun, but it suggests many possibility. I would like to see others expand on this.

@Ralph @Sling and my dear friend @JackZ. Jacques You started this Disco trend. :lol:

Code: Select all

color_palate_canvas= canvas_add(0,0,500,500)
--Create a Hex Table to provide (33x33x33) color palate 
ht={"ff","f8","f0","e8","e0","d8","d0","c8","c0","b8","b0","a8","a0","98","90","88","80","78","70","68","60","58","50","48","40","38","30","28","20","18","10","08","00"}

i3=1
a=1
function disco(count)	
	i3=i3+a
	i3 = var_cap(i3,1,33)

	canvas_draw(color_palate_canvas, function()		
		for i1=1,33 do	
			for i2 = 1,33 do														
				_rect(65+(i1*10),65+(i2*10),10,10)		
				_fill("#"..ht[i1]..ht[i2]..ht[i3])					
			end				
		end				
	end)
	if i3 == 33 then a = -1 end
	if i3 == 1 then a = 1 end	
rotate(	color_palate_canvas, 0, "LOG", 0.05)
rotate(	color_palate_canvas,25*i3)
end
timer_start(0,200,disco)

Keith
AMD RYZEN 9 5950X CPU, Corsair H80I cooler, ASUS TUF GAMING B550-PLUS AMD Ryzen Mother Board,  32Gb ram Corsair Vengeance 3000Mh, MSI GTX960 4G graphics card 

User avatar
Ralph
Posts: 7867
Joined: Tue Oct 27, 2015 7:02 pm
Location: De Steeg
Contact:

Re: Anyone done a Night Vision Goggle effect ?

#3 Post by Ralph »

I'm not sure if just a green overlay would work. It probably also has effect on light and shadows.

User avatar
Keith Baxter
Posts: 4671
Joined: Wed Dec 20, 2017 11:00 am
Location: Botswana

Re: Anyone done a Night Vision Goggle effect ?

#4 Post by Keith Baxter »

Ralph wrote: Wed Sep 23, 2020 6:37 pm I'm not sure if just a green overlay would work. It probably also has effect on light and shadows.
Ralph,

I am up for the challenge. I will draw a round bezel with color gradients using about 30 lines of code. I am sure guys like @Sling (yes I am challenging you Tony), could probably do it in fewer lines and before I wake up tomorrow morning. :mrgreen:

Keith

EDIT: I did a bit of experimenting with adding some extra code to try and get the feel for Night vision. The four corners show white, black. red and blue.
The overlay is a few shades of night vision green. You might want to add more or change those colors.
The opacity changes every 30 seconds so the whole cycle takes about 5 minutes. You should see the print statements indicate what color and what opacity is done.
Hope it helps.

Code: Select all

base_canvas = canvas_add(0,0,500,500, function()
	_rect(0,0,500,500)
	_fill("#37474f")
	_rect(20,20,50,50)
	_fill("white")
	_rect(430,20,50,50)
	_fill("black") 
	_rect(20,430,50,50)
	_fill("red")
	_rect(430,430,50,50)
	_fill("blue")  
end)
color_palate_canvas= canvas_add(0,0,500,500)
night_vision_canvas = canvas_add(0,0,500,500)

--Create a Hex Table to provide (33x33x33) color palate 
ht={"ff","f8","f0","e8","e0","d8","d0","c8","c0","b8","b0","a8","a0","98","90","88","80","78","70","68","60","58","50","48","40","38","30","28","20","18","10","08","00"}

night_table={"#010C01","#012301","#083205","#2E7901","#439413","#66BF2F"}

i3=1
a=1
function disco(count)	
	i3=i3+a
	i3 = var_cap(i3,1,33)
	canvas_draw(color_palate_canvas, function()		
		for i1=1,33 do	
			for i2 = 1,33 do														
				_rect(65+(i1*10),65+(i2*10),10,10)		
				_fill("#"..ht[i1]..ht[i2]..ht[i3])					
			end				
		end				
	end)
	if i3 == 33 then a = -1 end
	if i3 == 1 then a = 1 end	
rotate(	color_palate_canvas, 0, "LOG", 0.02)
rotate(	color_palate_canvas,32.75*i3)
end
timer_start(0,200,disco)
nc=0
b=1
function night_vision(count)
	if nc == 6 then b = -1 end
	if nc == 1 then b = 1 end
	nc=nc + b
--	nc = var_cap(nc,1,6)	
	canvas_draw(night_vision_canvas, function()		
		_rect(0,0,500,500)
		_fill(night_table[nc])
		_txt("Opacity is at  "..c*0.1,"font:arimo_bold.ttf; size:14; color: yellow; halign:center; valign:center;",350,20)	
		_txt("Color is  "..night_table[nc],"font:arimo_bold.ttf; size:14; color: yellow; halign:center; valign:center;",150,20)
	end)	
	print(night_table[nc])
end
timer_start(0,2500,night_vision)

c=0
d=1
function night_vision(count)
	c=c + d
	c = var_cap(c,1,10)	
opacity(night_vision_canvas,c*0.1)

	if c == 10 then d = -1 end
	if c == 1 then d = 1 end
	print("Opacity  "..c*0.1)
end
timer_start(0,30000,night_vision)



AMD RYZEN 9 5950X CPU, Corsair H80I cooler, ASUS TUF GAMING B550-PLUS AMD Ryzen Mother Board,  32Gb ram Corsair Vengeance 3000Mh, MSI GTX960 4G graphics card 

User avatar
Sling
Posts: 5237
Joined: Mon Sep 11, 2017 2:37 pm
Contact:

Re: Anyone done a Night Vision Goggle effect ?

#5 Post by Sling »

No interest in simulating NVG from my side, sorry.

Tony

Post Reply