www.jpct.net

jPCT - a 3d engine for Java => Support => Topic started by: zammbi on September 26, 2010, 06:51:17 am

Title: Broken light in software mode
Post by: zammbi on September 26, 2010, 06:51:17 am
So I was trying out my new obj cave model but when I loaded the textures, things really got messy. But when I used hardware mode everything was fine again. Bug? solutions?

Software mode:
(http://i51.tinypic.com/24b8as0.jpg)

Hardware mode:
(http://i53.tinypic.com/t7mohz.jpg)

Title: Re: Broken light in software mode
Post by: EgonOlsen on September 26, 2010, 10:04:28 am
Are these polygons just black or are they missing at all? Any unusual log messages?
Title: Re: Broken light in software mode
Post by: zammbi on September 26, 2010, 11:20:38 am
Just black. I seem to found the issue. It only happens when I turn on mipmapping.
No unusual messages that I can see.

I could send over the model if that helps you solve it.
Title: Re: Broken light in software mode
Post by: EgonOlsen on September 26, 2010, 02:44:34 pm
Yes, models and textures please. Seems to be a problem in software renderer's mipmap generation or calculation code then.
Title: Re: Broken light in software mode
Post by: EgonOlsen on September 27, 2010, 10:13:11 pm
...still waiting for the model... ;)
Title: Re: Broken light in software mode
Post by: zammbi on September 27, 2010, 10:44:14 pm
Sorry I been busy, been meaning too. I'll upload it after work today.
Title: Re: Broken light in software mode
Post by: zammbi on October 02, 2010, 03:09:17 am
Sorry for the delay. Have too much to do lately.

Here's the files.
http://www.mediafire.com/?damm6rkqlatqp2m
Title: Re: Broken light in software mode
Post by: EgonOlsen on October 02, 2010, 05:20:40 pm
Can't access it, it's set to private... :(
Title: Re: Broken light in software mode
Post by: zammbi on October 03, 2010, 03:30:07 am
Woops, sorry about that. Try now.
Title: Re: Broken light in software mode
Post by: EgonOlsen on October 04, 2010, 08:55:27 pm
The download works fine now. However, i can't verify the problem. Everything works as expected in my tests. But it may be caused by the size of those textures. They are 2048*2048. which is huge. Creating mip maps for these beats requires some memory, because it creates a new image from the pixel data (which is 16mb for one texture alone), i.e. 16 mb pixel data + 16mb image + the scaled instances and the pixel data of those leads to some serious memory usage. Maybe it's running into an OutOfMemory-Exception that somehow gets swallowed by your code leaving the generated mip maps in some in-between state.

BTW: 2048*2048 is pretty huge anyway. It will cause bad performance of the software renderer due to cache misses and it's not cheap on slower hardware either. Consider using a reduced version of the textures.