Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

AppGameKit Classic Chat / Jumping through flaming hoops

Author
Message
fubarpk
Retired Moderator
19
Years of Service
User Offline
Joined: 11th Jan 2005
Playing: AGK is my friend
Posted: 20th Dec 2018 16:56 Edited at: 23rd Dec 2018 09:42
Video removed for space please see latest post

Really just playing with blinks kart physics
but thought this was a good chance to show the new flaming hoop routine

For those interested in how its achieved
The hoop object uses a shader that just moves the uvs of a texture
Then there is a plane object placed where a flaming hoop video with transparency is played to the image

Theres also a traffic light shader that uses four textures normal,green,orange,red. These create a kind of
neon light (full bright) and look best when there is a fog as they will still show full bright
fubar
blink0k
Moderator
11
Years of Service
User Offline
Joined: 22nd Feb 2013
Location: the land of oz
Posted: 20th Dec 2018 18:54
haha. Very Nice
Xaby
FPSC Reloaded TGC Backer
17
Years of Service
User Offline
Joined: 17th Apr 2007
Location: Berlin
Posted: 20th Dec 2018 19:30
Shut up and take my money

@fubarpk
@blink0k
janbo
16
Years of Service
User Offline
Joined: 10th Nov 2008
Location: Germany
Posted: 20th Dec 2018 20:29 Edited at: 20th Dec 2018 20:50
@fubarpk: Just wanted to mention that you don't need 4 textures.
If you mean normal is the diffuse texture, you need 2 textures but the second one is a masking texture where in each color channel one light of the traffic light is set to 255,
So you could have the Red light in the red channel the orange light in the green channel and the green one in the blue channel or something.
Could become useful if you need some texture space.

Also why a video ? and not scrolling through an atlas texture... Is it faster ? ...anyhow it's a clever one, never used videos in a 3D scene
I have a sun shader lying around, I made for someone who left it to me if I wanted to publish it... is blink dudes project something we can contribute to ?
fubarpk
Retired Moderator
19
Years of Service
User Offline
Joined: 11th Jan 2005
Playing: AGK is my friend
Posted: 20th Dec 2018 22:26 Edited at: 20th Dec 2018 22:38
Quote: "If you mean normal is the diffuse texture, you need 2 textures but the second one is a masking texture where in each color channel one light of the traffic light is set to 255,"

I will have a look at that, to be honest I never thought of doing that I could just subtract the color channel I require and add 0.0 to other channels not required in my color variable
Oh I just thought why I use three textures as the location of each color is at a different spot and the other colors are not required at the time. As the traffic light uses one texture for lights
and the object and not a texture for the lights them self but that suggestion could come in handy for another project
Neon.ps


Neon.vs

Quote: "Also why a video ? and not scrolling through an atlas texture... Is it faster ?"

I think videos can be faster than complex shaders ideally I think a sprite animation would be the best especially if I did away
with using a complex shader and just code that swapped animation keyframes. I might go through the process of converting
the video to a sprite sheet. I did purchase the video and the only animated sprite sheets I found were very expensive and most
didn't look aswell as the video. Which came with a cirle,square,star,pole etc animation. I did know a site that converted videos
to gifs quite well once and I think graphics gale will import a gif and export as a sprite map.
Quote: "s blink dudes project something we can contribute to ?"

I think anyone can contribute to it, The main reason i started another thread is i didnt want to take over blinks thread
fubar
janbo
16
Years of Service
User Offline
Joined: 10th Nov 2008
Location: Germany
Posted: 21st Dec 2018 12:10
Quote: "Oh I just thought why I use three textures as the location of each color is at a different spot and the other colors are not required at the time. As the traffic light uses one texture for lights
and the object and not a texture for the lights them self"

Not sure what you are saying, sounds a bit like it's not working.
You don't need the actual color just pass the three colors as uniforms and use the second texture to get the position...the rest should be the same.
I'll make you an example if I get time.
fubarpk
Retired Moderator
19
Years of Service
User Offline
Joined: 11th Jan 2005
Playing: AGK is my friend
Posted: 21st Dec 2018 16:27 Edited at: 23rd Dec 2018 09:42
Thanks Janbo
Think il have to see an example
.
.
Blinks version 1.5 Kart Physics with my Crazy Additions

Video removed for space please see latest post

PS We now have car lights. A simple shader that still works well with mobile and allows for turning on and off and setting the cars lightin
fubar
Rick Nasher
7
Years of Service
User Offline
Joined: 25th Jul 2017
Location: Amsterdam
Posted: 21st Dec 2018 16:57
Awesome. Pretty hot flames!
And you did the rear lights, hehehe.
janbo
16
Years of Service
User Offline
Joined: 10th Nov 2008
Location: Germany
Posted: 21st Dec 2018 17:08 Edited at: 21st Dec 2018 17:08
Here you go
I quickly put it together, so many improvements possible, but you get the idea.
If you want lights which have a high variety of colors this technique isn't feasible anymore.
Demo

Attachments

Login to view attachments
Rick Nasher
7
Years of Service
User Offline
Joined: 25th Jul 2017
Location: Amsterdam
Posted: 21st Dec 2018 17:45 Edited at: 21st Dec 2018 18:10
Please forgive my ignorance guys, but I was able to do a couple of pretty nifty, yet very simple lights using only the AppGameKit inbuilt stuff:


Is there a distinct advantage of using shaders over that approach? ( I mean, I understand the advantage for complex stuff, but for this I don't know the reasoning behind it)
janbo
16
Years of Service
User Offline
Joined: 10th Nov 2008
Location: Germany
Posted: 21st Dec 2018 19:08
Quote: "Is there a distinct advantage of using shaders over that approach?"

Pretty much of "that" is already made with shaders, you just do a custom one that does the job just like you want it to and maybe even combine a few things so you get better performance.
Are those Lights seperate objects/meshes with emissive color ?
puzzler2018
User Banned
Posted: 21st Dec 2018 19:13 Edited at: 21st Dec 2018 19:16
Awesome work all of you

Difference to me is with things in AppGameKit is CPU bound - shaders is GPU.

The more AppGameKit commands - the more CPU

The more shaders - the more GPU power

So maybe perhaps balance it out between each to take things easy each processor

Thats entirely up to us though

EDIT - not sure if any are aware though that AppGameKit compiles our apps to use Shaders language anyway to ease off the CPU processing - fr the graphical stuff at least
fubarpk
Retired Moderator
19
Years of Service
User Offline
Joined: 11th Jan 2005
Playing: AGK is my friend
Posted: 21st Dec 2018 21:25 Edited at: 21st Dec 2018 21:34
Quote: "Please forgive my ignorance guys, but I was able to do a couple of pretty nifty, , yet very simple lights using only the AppGameKit inbuilt stuff"


Your lights look really impressive depending on how you achieved the above depends on the performance
for example I found I could only have 5 spotlights with my i5 3.2 gig quad core machine with 8 gb ram
and really only managed 2 spotlights at a time if I wanted a good frame rate. I also have a nividia card with
2GB ram which works quite well with hundreds of lights done using my shader method the difference is
they don't emit light in my version just give full glow which is fine for tail lights stop lights etc. I can fake the
fact that the light actually works by some clever texture shading in either the car tail light texture or the
traffic lights by dithering out the texture from the lights. I haven't done that yet but it will give the same effect
as your lights do on the wall if the wall and if the lights and wall were one object done with two textures and
be hundreds of times faster.
fubar
blink0k
Moderator
11
Years of Service
User Offline
Joined: 22nd Feb 2013
Location: the land of oz
Posted: 21st Dec 2018 21:35
Quote: "lights using only the AppGameKit inbuilt stuff: "

Was that using SetObjectColorEmissive()?
Rick Nasher
7
Years of Service
User Offline
Joined: 25th Jul 2017
Location: Amsterdam
Posted: 21st Dec 2018 22:36 Edited at: 21st Dec 2018 22:45
"...those Lights seperate objects/meshes with emissive color"

To answer you'all questions: indeed, emissive color.

Constructed all out of build in primitives with emissive color set and a light coming from it, which can actually also be set to 1255 as the 255 limit isn't actually there.
Gave some real nice neon-esque effects. Have to make sure that depending how large the range should be that you use thick 'concrete' walls so won't bleed through.
If you arrange them carefully, not too close to one another, so that they don't all mix on 1 surface then can work pretty well. In this particular scene I had 13 lights, when the player fired his gun then a 14th was in there, but can interfere indeed if not carefully placed.



"Your lights look really impressive depending on how you achieved the above depends on the performance"

Thanks. As you can see in this old screenshot on the top TL I actually forgot to place one of it's armatures.

I have an ancient HP dual core 1.8GHz with 4GB RAM laptop from 2007, with an ancient NVIDIA in it, so nothing fancy at all. Not much GPU power for shaders too, so I go as basic as I can and build from there. I was testing to see what limits would be reached. But overal pretty nice.
fubarpk
Retired Moderator
19
Years of Service
User Offline
Joined: 11th Jan 2005
Playing: AGK is my friend
Posted: 22nd Dec 2018 01:37 Edited at: 23rd Dec 2018 09:41
Nightmode by changing suncolor

This update has exploding objects with emmisive color (the squares and circles)
I also changed the texture used in the cars lights shader and added an agk logo

Video removed for space please see latest post

Thanks Janbo for the new traffic light shader code looks to me like it may improve performance over mine too
I can understand red and green I just will have to add something for the blue channel so it may be a different color
such as amber but a very clever routine

Car lights I think with some minor modifications to the car lights shader I should be able to make the hazard
lights flash which il have a go at now instead of being permanently on
fubar
fubarpk
Retired Moderator
19
Years of Service
User Offline
Joined: 11th Jan 2005
Playing: AGK is my friend
Posted: 22nd Dec 2018 06:15 Edited at: 23rd Dec 2018 09:41
Video removed for space please see latest post
breaklights and hazards and when you turn the hazards become indicators

Edit just needs reversing lights and a annoying beep lol
Ive coded it so as the hazards stay on but when you turn the hazards switch
off and the indicator comes on for that direction. Easy enough to implement
a hazard key
fubar
blink0k
Moderator
11
Years of Service
User Offline
Joined: 22nd Feb 2013
Location: the land of oz
Posted: 22nd Dec 2018 06:24
Oh i gotta do this now. it looks fantastic!
fubarpk
Retired Moderator
19
Years of Service
User Offline
Joined: 11th Jan 2005
Playing: AGK is my friend
Posted: 22nd Dec 2018 09:34 Edited at: 22nd Dec 2018 09:44
Thanks blink now have indicators
was very easy to implement just changing the hazards texture with agk
to either a left or right indicator texture. if no direction pressed restore
hazard texture

Easy enough to have a variable determine if hazards should work or not
but I kinda like the hazards permanently on

The shader could do with some optimising like janbo suggested for the
traffic lights, I just have to have a think about how il get all the different
colors into one mask layer ideally

Maybe chuck a L/P plate on the back and front of the car and have a
learn to drive course
fubar
GaborD
6
Years of Service
User Offline
Joined: 3rd Dec 2017
Location:
Posted: 22nd Dec 2018 19:06 Edited at: 22nd Dec 2018 19:14
Looks great! Hope you make a full game out of it.

For the layer mask coloring of your traffic lights, you could keep it really simple.
Assuming you have your basic color texture with red, yellow & green dots on a black background, you don't need a mask at all. You can stream in a single uniform, which is a vec2 with x being 0.0, 0.33 or 0.66 (for the three traffic light states) and y being 0.33 higher. This keeps the *0.33 and +0.33 out of the shader for a miniminiminimal speed increase.
Then you can just do a simple

Assuming a standard vertical traffic light layout and also standard uvs, this will set the inactive thirds to black.

If your background isn't black, you can just store an inverted mask in the alpha of the color texture and add a max() to keep outside areas from being multiplied to black. (in this case color has to be a vec4 ofcourse)


Or you just go to the dark side and use a conditional. Won't really cause a noticeable speed loss with such a simple branch unless you are targeting the toastiest toasters.
Actually, if the background is black, you could avoid the tex lookup altogether in the blacked out areas (on modern hardware that supports true branching), which does give a super tiny speed boost. Then again, on modern hardware it's fast anyway, more important to optimize for the toasters. Haha.


A third approach would be to use the ternary selection operator. ( a ? b : c )
But in this case step() is simpler I think.

In my opinion just test what runs best on your target hardware. There is no universal right or wrong for all hardware and all situations. It always depends.
I am sure this can be optimized further too, I am not a programmer.
Rick Nasher
7
Years of Service
User Offline
Joined: 25th Jul 2017
Location: Amsterdam
Posted: 22nd Dec 2018 20:40 Edited at: 22nd Dec 2018 20:43
Looking good!
You still need some headlights though, for otherwise if get's just a little bit more dark then you're basically driving blindly.

Now the million dollar question is: how to create a real spot light?
I managed to create sort of an 'police-sirene' like light, modeled after an example seen here somewhere(can't remember from who- long time ago and one of my first tests, maybe it was you


But that's not exactly the same as a spot light.

fubarpk
Retired Moderator
19
Years of Service
User Offline
Joined: 11th Jan 2005
Playing: AGK is my friend
Posted: 22nd Dec 2018 20:43
Quote: "Now the million dollar question is: how to create a real spot light?"

I created working headlights in my night driving app
fubar
Rick Nasher
7
Years of Service
User Offline
Joined: 25th Jul 2017
Location: Amsterdam
Posted: 22nd Dec 2018 20:48
@fubarpk
Did you use your own shader or the basic one?

I can still get things to look nice, for instance the streetlight on the right of above picture, or the elevator light, but it's not the same as a real spotlight I guess.
fubarpk
Retired Moderator
19
Years of Service
User Offline
Joined: 11th Jan 2005
Playing: AGK is my friend
Posted: 22nd Dec 2018 21:20 Edited at: 23rd Dec 2018 09:40
There ya go through in some basic headlights they need some tuning

Quote: "Did you use your own shader or the basic one?"

No shader used in night driving for the lights only one for stereoscopic view

below is the function I added to blinks co to get headlights


because you cant fix a light to an object you need the following in the main loop
The positioning is a little different in this than night driving due to the fact everything has been scaled up
fubar
Rick Nasher
7
Years of Service
User Offline
Joined: 25th Jul 2017
Location: Amsterdam
Posted: 22nd Dec 2018 23:08 Edited at: 22nd Dec 2018 23:11
@fubarpk
Quote: "because you cant fix a light to an object you need the following in the main loop"


I know, I've used this in my 1st/3rd player framework to have a light following an object that the player shoots. It then lights up the surroundings everywhere it passes.
Alternatively I had a version that would light up only the object when hit or a flash at the gun point when a shot was triggered.


Neither of these routines are in the current version as I'm focusing on other stuff but from an earlier not released version, which is a quick kludge and needs works still:


However. even though a method like this can simulate behaviors of a spotlight, it's not exactly the same as in a *real* spotlight that would generate a cone of light as in a headlight or flashlight.
Guess there are ways round it, like a semi-transparent cone or so, but I was wondering if this would be the preferred method..

BTW: nice update.
Xaby
FPSC Reloaded TGC Backer
17
Years of Service
User Offline
Joined: 17th Apr 2007
Location: Berlin
Posted: 23rd Dec 2018 11:02
@fubarpk

it looks like: Autoball / Rocket League made with AppGameKit is not far away
Maybe with local 4-player-mode soon

@Rick Nasher
looks like Super Mario Odyssee or Uncharted are on the way like your 3rd person stuff. Last time I checked, the jumping was a little bit stiff. But great work.
fubarpk
Retired Moderator
19
Years of Service
User Offline
Joined: 11th Jan 2005
Playing: AGK is my friend
Posted: 23rd Dec 2018 16:05
Merry Christmas To all
fubar
Rick Nasher
7
Years of Service
User Offline
Joined: 25th Jul 2017
Location: Amsterdam
Posted: 23rd Dec 2018 19:20
Merry Christmas and a Happy New Year too. Enjoy.

Login to post a reply

Server time is: 2024-11-27 02:08:34
Your offset time is: 2024-11-27 02:08:34