Share a Shader!

Questions about the LÖVE API, installing LÖVE and other support related questions go here.
Forum rules
Before you make a thread asking for help, read this.
Post Reply
User avatar
slime
Solid Snayke
Posts: 3161
Joined: Mon Aug 23, 2010 6:45 am
Location: Nova Scotia, Canada
Contact:

Re: Share a Shader!

Post by slime »

Out of curiosity, which card do you have? (if it's an intel one, be as specific as possible :p).
User avatar
Jasoco
Inner party member
Posts: 3726
Joined: Mon Jun 22, 2009 9:35 am
Location: Pennsylvania, USA
Contact:

Re: Share a Shader!

Post by Jasoco »

Well, I know the Intel 3000 HD in my MacBook Air supports shaders as well as a surprisingly huge amount of canvases up to 4096x4096 pixels. In laymans terms, it supports a boatload more than I'll ever need to use.

Also works on my Mac mini's NVIDIA GeForce 320M.

/Explanabrag
utunnels
Citizen
Posts: 75
Joined: Fri Jan 06, 2012 5:20 pm

Re: Share a Shader!

Post by utunnels »

slime wrote:if it's an intel one
You are right.

Guess I need to try another PC instead.
User avatar
Jasoco
Inner party member
Posts: 3726
Joined: Mon Jun 22, 2009 9:35 am
Location: Pennsylvania, USA
Contact:

Re: Share a Shader!

Post by Jasoco »

utunnels wrote:
slime wrote:if it's an intel one
You are right.

Guess I need to try another PC instead.
So what's your card?
utunnels
Citizen
Posts: 75
Joined: Fri Jan 06, 2012 5:20 pm

Re: Share a Shader!

Post by utunnels »

Intel (R) G33/G31 Express Chipset Family
User avatar
slime
Solid Snayke
Posts: 3161
Joined: Mon Aug 23, 2010 6:45 am
Location: Nova Scotia, Canada
Contact:

Re: Share a Shader!

Post by slime »

Ah, yeah. That's the Intel GMA 3100 I think. The GMA 900, 950, 3000 (not to be confused with the Intel HD 3000), 3100 (not to be confused with the Intel GMA X3100), and 3150 don't support programmable OpenGL shaders. :/
User avatar
vrld
Party member
Posts: 917
Joined: Sun Apr 04, 2010 9:14 pm
Location: Germany
Contact:

Re: Share a Shader!

Post by vrld »

SiENcE wrote:3D projection
For that you'd have to write your own 3D transformation code inside the pixel effect. While this is possible, you probably shouldn't do it. LOVE is a 2D engine after all. But if you insist, it's probably the easiest to use some kind of raycasting algorithm. Depending on where the ray hits a textures the surface, you can calculate the texture coordinates, which you can then use with the Texel(tex, coords) function.
I'll try to write a simple example when I'm home.

Edit:
Here it is. It is a simple raycaster implementation showing two spheres with faked ambient occlusion. Texture coordinates are computed using the surface normals of the spheres. I tried to optimize it somewhat for speed, but even now it is not very fast, so you probably not do this in an actual game. The relevant code bit is this:

Code: Select all

// use normal for texture coordinates
tc = n.xy * .5 + vec2(.5);
return Texel(texture, tc) * vec4(ao,ao,ao, 1.0);
Play with different ways to calculate the texture coordinates (e.g. tc = n.zy * .5 + vec2(.5)) to see how this works.
Attachments
raycast.love
(69.75 KiB) Downloaded 633 times
I have come here to chew bubblegum and kick ass... and I'm all out of bubblegum.

hump | HC | SUIT | moonshine
User avatar
SiENcE
Party member
Posts: 804
Joined: Thu Jul 24, 2008 2:25 pm
Location: Berlin/Germany
Contact:

Re: Share a Shader!

Post by SiENcE »

Thats nice vrld. Thanks for this shader!

I know that Love2D is a 2D engine, but sometimes it's usefull to have 3d projections instead of precalc different textures.

Thx.
User avatar
kraftman
Party member
Posts: 277
Joined: Sat May 14, 2011 10:18 am

Re: Share a Shader!

Post by kraftman »

I've updated all my examples to the latest 0.8 build, hopefully they will be useful to someone.
User avatar
titangate
Prole
Posts: 11
Joined: Tue Apr 26, 2011 4:24 am

Re: Share a Shader!

Post by titangate »

Here's a shockwave shader i ported from some random website. Purely experimental, and please forgive me for losing track the source :(

click to spawn a shockwave
Attachments
shockwave.love
(156.32 KiB) Downloaded 859 times
Post Reply

Who is online

Users browsing this forum: Bing [Bot] and 0 guests