Skip to content

Crytek sponza not working :'( #15

@ghost

Description

Hello. I trying crytek sponza (not dabrovic). And gets these errors.

Code

package main

// http://graphics.cs.williams.edu/data/meshes/dabrovic-sponza.zip

import . "../pt"

func main() {
	scene := Scene{}
	material := GlossyMaterial(HexColor(0xFCFAE1), 1.5, Radians(20))
	mesh, err := LoadOBJ("sponza.obj", material)
	if err != nil {
		panic(err)
	}
	mesh.MoveTo(Vector{}, Vector{0.5, 0, 0.5})
	scene.Add(mesh)
	scene.Add(NewSphere(Vector{0, 20, 0}, 3, LightMaterial(White, 100)))
	camera := LookAt(Vector{-10, 2, 0}, Vector{0, 4, 0}, Vector{0, 1, 0}, 45)
	sampler := NewSampler(4, 4)
	renderer := NewRenderer(&scene, &camera, sampler, 960, 540)
	renderer.IterativeRender("out%03d.png", 1000)
}

Error

C:\Users\acterhd\Downloads\pt-master\examples>go run sponza.go
Loading OBJ: sponza.obj
Loading MTL: sponza.mtl
Loading IMG: textures\sponza_thorn_diff.png
Loading IMG: textures\sponza_thorn_bump.png
Loading IMG: textures\vase_round.png
Loading IMG: textures\vase_round_bump.png
Loading IMG: textures\vase_plant.png
Loading IMG: textures\background.png
Loading IMG: textures\background_bump.png
Loading IMG: textures\gi_flag.png
Loading IMG: textures\spnza_bricks_a_diff.png
Loading IMG: textures\spnza_bricks_a_bump.png
Loading IMG: textures\sponza_arch_diff.png
Loading IMG: textures\sponza_ceiling_a_diff.png
Loading IMG: textures\sponza_column_a_diff.png
Loading IMG: textures\sponza_column_a_bump.png
Loading IMG: textures\sponza_floor_a_diff.png
Loading IMG: textures\sponza_column_c_diff.png
Loading IMG: textures\sponza_column_c_bump.png
Loading IMG: textures\sponza_details_diff.png
Loading IMG: textures\sponza_column_b_diff.png
Loading IMG: textures\sponza_column_b_bump.png
Loading IMG: textures\sponza_flagpole_diff.png
Loading IMG: textures\sponza_fabric_green_diff.png
Loading IMG: textures\sponza_fabric_blue_diff.png
Loading IMG: textures\sponza_fabric_diff.png
Loading IMG: textures\sponza_curtain_blue_diff.png
Loading IMG: textures\sponza_curtain_diff.png
Loading IMG: textures\sponza_curtain_green_diff.png
Loading IMG: textures\chain_texture.png
Loading IMG: textures\chain_texture_bump.png
Loading IMG: textures\vase_hanging.png
Loading IMG: textures\vase_dif.png
Loading IMG: textures\vase_bump.png
Loading IMG: textures\lion.png
Loading IMG: textures\lion_bump.png
Loading IMG: textures\sponza_roof_diff.png
Loading IMG: textures\sponza_roof_bump.png
panic: runtime error: invalid memory address or nil pointer dereference
[signal 0xc0000005 code=0x0 addr=0x38 pc=0x4596c6]

goroutine 1 [running]:
panic(0x505b60, 0xc04200c090)
        C:/Go/src/runtime/panic.go:500 +0x1af
_/C_/Users/acterhd/Downloads/pt-master/pt.LoadMTL(0xc04205c4a7, 0xa, 0x3fef2d779e37e205, 0x3feea2c5857ecb8e, 0x3fe84c2e92434b0b, 0x0, 0x0, 0x0, 0x0, 0x0, ...)
        C:/Users/acterhd/Downloads/pt-master/pt/obj.go:137 +0x5c6
_/C_/Users/acterhd/Downloads/pt-master/pt.LoadOBJ(0x526f3e, 0xa, 0x3fef2d779e37e205, 0x3feea2c5857ecb8e, 0x3fe84c2e92434b0b, 0x0, 0x0, 0x0, 0x0, 0x0, ...)
        C:/Users/acterhd/Downloads/pt-master/pt/obj.go:46 +0x1423
main.main()
        C:/Users/acterhd/Downloads/pt-master/examples/sponza.go:10 +0x1fd
exit status 2

There these models, with you can test
https://1drv.ms/f/s!AgEr-N6c2tdUhLMh11zNIP1besSUbQ

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions