Advertise Mobile SDKs Books Events Forum News Social Networking Support Us
Follow @iphonedevsdk on Twitter

Interface 2, Advanced iOS
Mockup & Code Gen
($9.99)

Make your own iPhone apps
and run them live!
(free)

Pic Frame Dynamo: Photo Editing
($0.99)

Abiliator
($1.99)

Want your application or service advertised on iPhone Dev SDK?

Go Back   iPhone Dev SDK Forum > iPhone SDK Development Forums > iPhone SDK Game Development

Reply
 
LinkBack Thread Tools Display Modes
Old 12-10-2010, 12:17 AM   #1 (permalink)
Registered Member
 
Join Date: Sep 2010
Posts: 22
Splatics is on a distinguished road
Default Opengl ES Point Sprites

I have an explosion particle effect using point sprites in my 3D game and also 3D models all over in it. My problem is that when I draw my point sprites if I have depth testing turned on then my point sprites cover each other up when they are drawn, but if I have the depth test turned off then the particle effect looks great and blending works great but every particle effect is rendered in front of all objects in the scene no matter if the the objects are completely covering it or not.
Does anyone know how to render the point sprites with depth testing so that if an object is in front of the point sprites then you wont be able to see it?
Please let me know if this needs better explaining. Thanks!
Splatics is offline   Reply With Quote
Old 12-10-2010, 12:23 AM   #2 (permalink)
Registered Member
 
headkaze's Avatar
 
Join Date: Feb 2010
Posts: 359
headkaze is on a distinguished road
Default

You need to sort your sprites by their Z position and render them in that order.
headkaze is offline   Reply With Quote
Old 12-10-2010, 12:23 AM   #3 (permalink)
Registered Member
 
Join Date: Nov 2008
Posts: 234
warmi is on a distinguished road
Default

Quote:
Originally Posted by Splatics View Post
I have an explosion particle effect using point sprites in my 3D game and also 3D models all over in it. My problem is that when I draw my point sprites if I have depth testing turned on then my point sprites cover each other up when they are drawn, but if I have the depth test turned off then the particle effect looks great and blending works great but every particle effect is rendered in front of all objects in the scene no matter if the the objects are completely covering it or not.
Does anyone know how to render the point sprites with depth testing so that if an object is in front of the point sprites then you wont be able to see it?
Please let me know if this needs better explaining. Thanks!
For your particles you should use depth testing but disable depth writing so that they are properly occluded by non-particle objects while not occluding each other.
warmi is offline   Reply With Quote
Old 12-10-2010, 12:26 AM   #4 (permalink)
Registered Member
 
headkaze's Avatar
 
Join Date: Feb 2010
Posts: 359
headkaze is on a distinguished road
Default

Quote:
Originally Posted by warmi View Post
For your particles you should use depth testing but disable depth writing so that they are properly occluded by non-particle objects while not occluding each other.
That's interesting.. how do you turn off depth writing?
headkaze is offline   Reply With Quote
Old 12-10-2010, 12:43 AM   #5 (permalink)
Registered Member
 
Join Date: Nov 2008
Posts: 234
warmi is on a distinguished road
Default

Quote:
Originally Posted by headkaze View Post
That's interesting.. how do you turn off depth writing?
glDepthMask
warmi is offline   Reply With Quote
Old 12-10-2010, 09:50 AM   #6 (permalink)
Registered Member
 
Join Date: Sep 2010
Posts: 22
Splatics is on a distinguished road
Default It worked!

Quote:
Originally Posted by warmi View Post
Awesome! Thanks, this worked!
Splatics is offline   Reply With Quote
Reply

Bookmarks

Tags
opengl es, particles, point sprites

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



» Advertisements
» Online Users: 414
11 members and 403 guests
7twenty7, ChrisYates, djohnson, gmarro, hussain1982, Kirkout, Retouchable, skrew88, SLIC, walex, xzoonxoom
Most users ever online was 1,387, 04-10-2012 at 04:21 AM.
» Stats
Members: 175,679
Threads: 94,128
Posts: 402,921
Top Poster: BrianSlick (7,990)
Welcome to our newest member, xzoonxoom
Powered by vBadvanced CMPS v3.1.0

All times are GMT -5. The time now is 08:09 AM.
Powered by vBulletin® Version 3.8.0
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.3.0