Author Topic: lighting  (Read 1724 times)

Offline Disastorm

  • long
  • ***
  • Posts: 161
    • View Profile
lighting
« on: March 26, 2011, 07:32:21 am »
Hello, do you know why the ground in this screenshot doesn't seem to be affected by the lighting?  Its part of the same .obj file as the rock which seems to be affected by the lighting.




Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 11776
    • View Profile
    • http://www.jpct.net
Re: lighting
« Reply #1 on: March 26, 2011, 08:46:40 am »
Might be caused by the position of the light source (make sure that it isn't located in the plane) or the number of polygons used for the plane. Without shaders, you are using vertex lighting, i.e. no point within a polygon can be brighter then any of its vertices.

Offline Disastorm

  • long
  • ***
  • Posts: 161
    • View Profile
Re: lighting
« Reply #2 on: March 26, 2011, 09:09:01 am »
ok thanks i think the polygon thing is the problem.  I increased my polygon and i can see the ground get lighted.  However, it seems my "enemies" lag the game whenever they move now, with more polygons, collision detection takes longer to do??  Perhaps in this case then your mvc (what does this stand for) method might be the best idea, have a duplicate world where all the objects are just basic primitives (essentially have 2 .obj files for each "level") without many polygons and use that for collision detection and then move all the stuff in the real world along with them?  Collision detection should be fast this way since the real world high-poly stuff will be Collision Mode None right, or will they still slow it down just for existing?

Also are shaders easy to use [if I don't know anything about them] or do I have to do a bunch of stuff to get them working, and also is shaders the only thing that makes it so light can be blocked by an object?





btw this is unrelated, but every now and then when i start my program i get this error do u know what it can be, I think I only started getting it after i got SoundSystemJPCT which also required me to update lwjgl although I still havn't actually gotten SoundSystem working, so I don't know if SoundSystem or lwjgl is causing this.

Code: [Select]
#
# A fatal error has been detected by the Java Runtime Environment:
#
#  EXCEPTION_ACCESS_VIOLATION (0xc0000005) at pc=0x000000006994f2e9, pid=400, tid=2868
#
# JRE version: 6.0_22-b04
# Java VM: Java HotSpot(TM) 64-Bit Server VM (17.1-b03 mixed mode windows-amd64 )
# Problematic frame:
# C  [atio6axx.dll+0x91f2e9]
#
# If you would like to submit a bug report, please visit:
#   http://java.sun.com/webapps/bugreport/crash.jsp
# The crash happened outside the Java Virtual Machine in native code.
# See problematic frame for where to report the bug.
#

---------------  T H R E A D  ---------------

Current thread (0x00000000005dc800):  JavaThread "main" [_thread_in_native, id=2868, stack(0x0000000002410000,0x0000000002510000)]

siginfo: ExceptionCode=0xc0000005, reading address 0x000000000c327000

Registers:
EAX=0x00000000698ceb80, EBX=0x000000000f50cc00, ECX=0x00000000139fd3e0, EDX=0x0000000000000020
ESP=0x000000000250ed40, EBP=0x000000006a485740, ESI=0x00000000106c1e38, EDI=0x00000000106c1e38
EIP=0x000000006994f2e9, EFLAGS=0x0000000000010206

Top of Stack: (sp=0x000000000250ed40)
0x000000000250ed40:   000000000f50cc00 000000006a485740
0x000000000250ed50:   00000000106c1e38 000000006993990b
0x000000000250ed60:   000000000f50cc00 000000006a485740
0x000000000250ed70:   0000000000000000 0000000000001600
0x000000000250ed80:   0000000000000004 00000000697c6e22
0x000000000250ed90:   0000000000000007 000000006a4a7900
0x000000000250eda0:   0000000000000000 000000006a485740
0x000000000250edb0:   000000000250ef00 0000000000f00a80
0x000000000250edc0:   0000000040000024 0000000000000000
0x000000000250edd0:   0000000000000000 00000000000000b5
0x000000000250ede0:   0000000000000007 00000000000000b5
0x000000000250edf0:   00000000000000b5 00000000000000b5
0x000000000250ee00:   00000000000000b5 00000000000000b5
0x000000000250ee10:   0000000000000001 000000000250f100
0x000000000250ee20:   00000000000000b5 00000000000000b5
0x000000000250ee30:   00000000000000b5 00000000000000b5

Instructions: (pc=0x000000006994f2e9)
0x000000006994f2d9:   00 00 45 89 63 10 48 8d 05 9a f8 f7 ff 49 89 03
0x000000006994f2e9:   41 8b 45 00 41 89 43 14 41 8b 45 04 41 89 43 18


Stack: [0x0000000002410000,0x0000000002510000],  sp=0x000000000250ed40,  free space=3fb0000000000000000k
Native frames: (J=compiled Java code, j=interpreted, Vv=VM code, C=native code)
C  [atio6axx.dll+0x91f2e9]

Java frames: (J=compiled Java code, j=interpreted, Vv=VM code)
j  org.lwjgl.opengl.GL11.nglDrawElements(IIILjava/nio/Buffer;IJ)V+0
j  org.lwjgl.opengl.GL11.glDrawElements(ILjava/nio/IntBuffer;)V+37
j  com.threed.jpct.CompiledInstance.compileToDL()V+234
j  com.threed.jpct.GLBase.compileDLOrVBO()V+57
j  com.threed.jpct.GLRenderer.drawVertexArray(Lcom/threed/jpct/VisList;IILcom/threed/jpct/FrameBuffer;Lcom/threed/jpct/World;)V+42
j  com.threed.jpct.World.draw(Lcom/threed/jpct/FrameBuffer;ZIII)V+438
j  com.threed.jpct.World.draw(Lcom/threed/jpct/FrameBuffer;ZI)V+12
j  com.threed.jpct.World.draw(Lcom/threed/jpct/FrameBuffer;)V+4
j  game.project3d.Main.loop()V+169
j  game.project3d.Main.<init>(Lcom/threed/jpct/FrameBuffer;Ljava/io/ObjectOutputStream;Ljava/io/ObjectInputStream;Ljava/net/Socket;)V+519
j  game.project3d.TestGameSingle.main([Ljava/lang/String;)V+8
v  ~StubRoutines::call_stub

---------------  P R O C E S S  ---------------

Java Threads: ( => current thread )
  0x0000000009371000 JavaThread "Thread-16" [_thread_blocked, id=4864, stack(0x00000000020d0000,0x00000000021d0000)]
  0x0000000009370000 JavaThread "Thread-15" [_thread_blocked, id=1820, stack(0x0000000010b00000,0x0000000010c00000)]
  0x00000000064ae000 JavaThread "AWT-Windows" daemon [_thread_in_native, id=636, stack(0x0000000008520000,0x0000000008620000)]
  0x0000000007998800 JavaThread "Java2D Disposer" daemon [_thread_blocked, id=2284, stack(0x0000000008320000,0x0000000008420000)]
  0x00000000063f7000 JavaThread "Timer-0" [_thread_blocked, id=3716, stack(0x0000000007520000,0x0000000007620000)]
  0x000000000632f000 JavaThread "Low Memory Detector" daemon [_thread_blocked, id=796, stack(0x0000000007320000,0x0000000007420000)]
  0x000000000632b800 JavaThread "CompilerThread1" daemon [_thread_blocked, id=1452, stack(0x0000000007220000,0x0000000007320000)]
  0x00000000062e2000 JavaThread "CompilerThread0" daemon [_thread_in_native, id=4652, stack(0x0000000007120000,0x0000000007220000)]
  0x00000000062e0800 JavaThread "Attach Listener" daemon [_thread_blocked, id=1096, stack(0x0000000007020000,0x0000000007120000)]
  0x00000000062e0000 JavaThread "Signal Dispatcher" daemon [_thread_blocked, id=524, stack(0x0000000006f20000,0x0000000007020000)]
  0x00000000062c8000 JavaThread "Finalizer" daemon [_thread_blocked, id=3900, stack(0x0000000006e20000,0x0000000006f20000)]
  0x00000000062c3000 JavaThread "Reference Handler" daemon [_thread_blocked, id=4824, stack(0x0000000006d20000,0x0000000006e20000)]
=>0x00000000005dc800 JavaThread "main" [_thread_in_native, id=2868, stack(0x0000000002410000,0x0000000002510000)]

Other Threads:
  0x00000000062bf000 VMThread [stack: 0x0000000006c20000,0x0000000006d20000] [id=1128]
  0x0000000006343800 WatcherThread [stack: 0x0000000007420000,0x0000000007520000] [id=848]

VM state:not at safepoint (normal execution)

VM Mutex/Monitor currently owned by a thread: None

Heap
 PSYoungGen      total 502592K, used 351245K [0x00000000da950000, 0x00000001053f0000, 0x00000001053f0000)
  eden space 406080K, 86% used [0x00000000da950000,0x00000000f0053578,0x00000000f35e0000)
  from space 96512K, 0% used [0x00000000f35e0000,0x00000000f35e0000,0x00000000f9420000)
  to   space 93632K, 0% used [0x00000000ff880000,0x00000000ff880000,0x00000001053f0000)
 PSOldGen        total 500416K, used 322517K [0x00000000853f0000, 0x00000000a3ca0000, 0x00000000da950000)
  object space 500416K, 64% used [0x00000000853f0000,0x0000000098ee5548,0x00000000a3ca0000)
 PSPermGen       total 21248K, used 15834K [0x000000007fff0000, 0x00000000814b0000, 0x00000000853f0000)
  object space 21248K, 74% used [0x000000007fff0000,0x0000000080f66920,0x00000000814b0000)

Dynamic libraries:
0x0000000000400000 - 0x000000000042e000 C:\Program Files\Java\jdk1.6.0_22\bin\java.exe
0x0000000077bc0000 - 0x0000000077d6c000 C:\Windows\SYSTEM32\ntdll.dll
0x0000000077aa0000 - 0x0000000077bbf000 C:\Windows\system32\kernel32.dll
0x000007fefdbd0000 - 0x000007fefdc3b000 C:\Windows\system32\KERNELBASE.dll
0x000007feff0a0000 - 0x000007feff17b000 C:\Windows\system32\ADVAPI32.dll
0x000007feff560000 - 0x000007feff5ff000 C:\Windows\system32\msvcrt.dll
0x000007feffca0000 - 0x000007feffcbf000 C:\Windows\SYSTEM32\sechost.dll
0x000007feffda0000 - 0x000007feffece000 C:\Windows\system32\RPCRT4.dll
0x000000006d890000 - 0x000000006df61000 C:\Program Files\Java\jdk1.6.0_22\jre\bin\server\jvm.dll
0x00000000779a0000 - 0x0000000077a9a000 C:\Windows\system32\USER32.dll
0x000007feff180000 - 0x000007feff1e7000 C:\Windows\system32\GDI32.dll
0x000007feff600000 - 0x000007feff60e000 C:\Windows\system32\LPK.dll
0x000007feffa20000 - 0x000007feffaea000 C:\Windows\system32\USP10.dll
0x000007fefbb50000 - 0x000007fefbb8b000 C:\Windows\system32\WINMM.dll
0x000007feff320000 - 0x000007feff34e000 C:\Windows\system32\IMM32.DLL
0x000007feffb90000 - 0x000007feffc99000 C:\Windows\system32\MSCTF.dll
0x000007feff350000 - 0x000007feff552000 C:\Windows\system32\ole32.dll
0x000000006d800000 - 0x000000006d80e000 C:\Program Files\Java\jdk1.6.0_22\jre\bin\verify.dll
0x000000006d450000 - 0x000000006d477000 C:\Program Files\Java\jdk1.6.0_22\jre\bin\java.dll
0x000000006d3b0000 - 0x000000006d3ba000 C:\Program Files\Java\jdk1.6.0_22\jre\bin\hpi.dll
0x0000000077d90000 - 0x0000000077d97000 C:\Windows\system32\PSAPI.DLL
0x000000006d850000 - 0x000000006d862000 C:\Program Files\Java\jdk1.6.0_22\jre\bin\zip.dll
0x000000006d6a0000 - 0x000000006d6b7000 C:\Program Files\Java\jdk1.6.0_22\jre\bin\net.dll
0x000007feff9d0000 - 0x000007feffa1d000 C:\Windows\system32\WS2_32.dll
0x000007feffd10000 - 0x000007feffd18000 C:\Windows\system32\NSI.dll
0x000007fefd390000 - 0x000007fefd3e4000 C:\Windows\system32\mswsock.dll
0x000007fefd380000 - 0x000007fefd387000 C:\Windows\System32\wship6.dll
0x000007fefcd60000 - 0x000007fefcd67000 C:\Windows\System32\wshtcpip.dll
0x000007fefd210000 - 0x000007fefd26b000 C:\Windows\system32\DNSAPI.dll
0x000007fefb1a0000 - 0x000007fefb1c7000 C:\Windows\system32\IPHLPAPI.DLL
0x000007fefb180000 - 0x000007fefb18b000 C:\Windows\system32\WINNSI.DLL
0x000007fef9980000 - 0x000007fef9988000 C:\Windows\system32\rasadhlp.dll
0x000007fefb040000 - 0x000007fefb093000 C:\Windows\System32\fwpuclnt.dll
0x0000000007620000 - 0x0000000007670000 C:\Users\Disastorm\Documents\NetBeansProjects\ProjectDerby\lwjgl64.dll
0x000007fef6530000 - 0x000007fef664d000 C:\Windows\system32\OPENGL32.dll
0x000007fef8b30000 - 0x000007fef8b5d000 C:\Windows\system32\GLU32.dll
0x000007fef6030000 - 0x000007fef6121000 C:\Windows\system32\DDRAW.dll
0x000007fef8ce0000 - 0x000007fef8ce8000 C:\Windows\system32\DCIMAN32.dll
0x000007fefdef0000 - 0x000007fefe0c7000 C:\Windows\system32\SETUPAPI.dll
0x000007fefdeb0000 - 0x000007fefdee6000 C:\Windows\system32\CFGMGR32.dll
0x000007feff610000 - 0x000007feff6e7000 C:\Windows\system32\OLEAUT32.dll
0x000007fefddb0000 - 0x000007fefddca000 C:\Windows\system32\DEVOBJ.dll
0x000007fefbec0000 - 0x000007fefbed8000 C:\Windows\system32\dwmapi.dll
0x000007fefcc40000 - 0x000007fefcc4c000 C:\Windows\system32\VERSION.dll
0x000007fefc350000 - 0x000007fefc544000 C:\Windows\WinSxS\amd64_microsoft.windows.common-controls_6595b64144ccf1df_6.0.7600.16661_none_fa62ad231704eab7\COMCTL32.dll
0x000007feffd20000 - 0x000007feffd91000 C:\Windows\system32\SHLWAPI.dll
0x000000006d0a0000 - 0x000000006d263000 C:\Program Files\Java\jdk1.6.0_22\jre\bin\awt.dll
0x000007fef8920000 - 0x000007fef8990000 C:\Windows\system32\WINSPOOL.DRV
0x000007fefe310000 - 0x000007feff096000 C:\Windows\system32\SHELL32.dll
0x000007fefc2a0000 - 0x000007fefc2f6000 C:\Windows\system32\uxtheme.dll
0x000007fefda50000 - 0x000007fefda5f000 C:\Windows\system32\CRYPTBASE.dll
0x000000006d570000 - 0x000000006d5a5000 C:\Program Files\Java\jdk1.6.0_22\jre\bin\jpeg.dll
0x000007feef9c0000 - 0x000007feefbbf000 C:\Windows\system32\d3d9.dll
0x000007feef9b0000 - 0x000007feef9b7000 C:\Windows\system32\d3d8thk.dll
0x00000000717f0000 - 0x00000000718a4000 C:\Windows\system32\aticfx64.dll
0x000007feef9a0000 - 0x000007feef9ad000 C:\Windows\system32\atiu9p64.dll
0x000000006f1a0000 - 0x000000006f6ba000 C:\Windows\system32\atiumd64.dll
0x000000006f8b0000 - 0x000000006fbdc000 C:\Windows\system32\atiumd6a.dll
0x000000006d340000 - 0x000000006d3a6000 C:\Program Files\Java\jdk1.6.0_22\jre\bin\fontmanager.dll
0x000007fefc860000 - 0x000007fefc868000 C:\Windows\system32\atig6pxx.dll
0x0000000069030000 - 0x000000006a5dd000 C:\Windows\system32\atio6axx.dll
0x0000000008070000 - 0x00000000080cb000 C:\Windows\system32\atiadlxx.dll
0x000007fefce60000 - 0x000007fefce7e000 C:\Windows\system32\USERENV.dll
0x000007fefdb20000 - 0x000007fefdb2f000 C:\Windows\system32\profapi.dll
0x000007fefcd40000 - 0x000007fefcd51000 C:\Windows\system32\WTSAPI32.dll
0x000007fefde70000 - 0x000007fefdeaa000 C:\Windows\system32\WINTRUST.dll
0x000007fefdc40000 - 0x000007fefdda6000 C:\Windows\system32\CRYPT32.dll
0x000007fefdbc0000 - 0x000007fefdbcf000 C:\Windows\system32\MSASN1.dll
0x000007fefc850000 - 0x000007fefc85e000 C:\Windows\system32\atig6txx.dll
0x000007fef9260000 - 0x000007fef92fc000 C:\Windows\system32\mscms.dll
0x000007fefb320000 - 0x000007fefb362000 C:\Windows\system32\icm32.dll
0x000000006d6c0000 - 0x000000006d6cb000 C:\Program Files\Java\jdk1.6.0_22\jre\bin\nio.dll
0x000007fefd3f0000 - 0x000007fefd407000 C:\Windows\system32\CRYPTSP.dll
0x000007fefd0f0000 - 0x000007fefd137000 C:\Windows\system32\rsaenh.dll
0x000007fefbb30000 - 0x000007fefbb45000 C:\Windows\system32\NLAapi.dll
0x000007fef9cd0000 - 0x000007fef9cdb000 C:\Windows\System32\winrnr.dll
0x000007fef9430000 - 0x000007fef9445000 C:\Windows\system32\napinsp.dll
0x000007fef9410000 - 0x000007fef9429000 C:\Windows\system32\pnrpnsp.dll
0x000007fef6650000 - 0x000007fef66d8000 C:\Windows\system32\dsound.dll
0x000007fefcd10000 - 0x000007fefcd3c000 C:\Windows\system32\POWRPROF.dll
0x000007fefe0d0000 - 0x000007fefe169000 C:\Windows\system32\CLBCatQ.DLL
0x000007fefc9a0000 - 0x000007fefc9eb000 C:\Windows\System32\MMDevApi.dll
0x000007fefc870000 - 0x000007fefc99c000 C:\Windows\System32\PROPSYS.dll
0x000007fefb980000 - 0x000007fefb9cf000 C:\Windows\system32\AUDIOSES.DLL
0x0000000180000000 - 0x0000000180053000 C:\Users\Disastorm\Documents\NetBeansProjects\ProjectDerby\OpenAL64.dll
0x000007fefc840000 - 0x000007fefc849000 C:\Windows\system32\avrt.dll

VM Arguments:
jvm_args: -Dfile.encoding=UTF-8
java_command: game.project3d.TestGameSingle
Launcher Type: SUN_STANDARD
« Last Edit: March 26, 2011, 10:57:57 pm by Disastorm »

Offline Disastorm

  • long
  • ***
  • Posts: 161
    • View Profile
Re: lighting
« Reply #3 on: March 26, 2011, 11:00:02 pm »
bump to renew thread for people who saw it before, since i edited stuff in my last post.


*edit
I tried out the MVC method and it works, my collision detection does not lag and my "real" world can have alot of polygons to have good lighting while the "fake" world is low polygon.  However, I am still interested in knowing if theres a way to make objects block light, is the only way with these Shader things?
« Last Edit: March 27, 2011, 05:30:26 am by Disastorm »

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 11776
    • View Profile
    • http://www.jpct.net
Re: lighting
« Reply #4 on: March 27, 2011, 09:27:18 am »
About the crash: Are you using compiled objects? If so, they tend to cause these crashes from time to time when creating the display lists. It's a driver problem. There's some thread here that deals with this. The solution is to use the latest beta and use vbos instead of display lists. The next official release will default to vbos. If you aren't using compiled objects, then i have no idea.
Objects blocking light is usually known as  shadow casting. There's a class called ShadowHelper that you might want to play around with a little bit.
« Last Edit: March 28, 2011, 07:15:57 am by EgonOlsen »

Offline Disastorm

  • long
  • ***
  • Posts: 161
    • View Profile
Re: lighting
« Reply #5 on: March 27, 2011, 09:59:40 am »
oh ok maybe thats it then, I do use compiled objects, although i don't really know what display lists or vbos is.