Forum Replies Created
-
AuthorPosts
-
Woah, nice!
Was gonna give you a speech about ‘monkey2 isn’t really meant for that’ but if you can make it work go for it!
Transparency isn’t supported yet, should be added soon!
I’m thinking the struct needs to match the naming in windows.h or… ?
Yes, defnitely, that’s why WINRECT__ didn’t work, there’s no such thing in windows.h.
So yes, the naming is important, the compiler has to be able to find the definition of struct RECT or whatever it is somewhere.
Actually, for now at least, all meshes that use PbrMaterial are gonna need texcoords, normals and tangents. Will add a simpler non-bumpy PBR style material in future.
Ok, main problem seems to be that it lacked texture coordinates and normals.
I’m not 100% sure why this is affecting shadows so much though. There is a bit of hack in the shaders that moves points ‘off’ surfaces in the direction of the normal when comparing shadow depth, but it should still work with no normals. Will eventually investigate.
Alas there is no UpdateNormals() yet so you need to manually create them – easy in this case though as they are all the same, ie: 0,0,-1.
Also, for UpdateTangents to work a mesh must have both valid normals AND texture coordinates. Tangents are only used for bumpmapping though, so not strictly neccesary in this case.
Sorry I haven’t been able to spend more time on the 3d lately everyone. IAP is *nearly* finished so I should be back into it soon.
Anyway, here’s a version that works for me….
Monkey123456789101112131415161718192021222324252627282930313233343536373839404142Function CreateGrid:Mesh( width:Double, height:Double, columns:Int = 1, rows:Int = 1, center:Vec2f = New Vec2f(0.5, 0.5 ) )If columns < 1 Then columns = 1If rows < 1 Then rows = 1Local i := -1Local verts := New Stack<Vertex3f>Local faces := New Stack<UInt>Local cellWidth := width / columnsLocal cellHeight := height / rowsFor Local y := 0 Until rowsFor Local x := 0 Until columns'Create each quadLocal startX := x*cellWidth - ( width*center.X )Local startY := y*cellHeight - ( height*center.Y )Local s0:=float(x)/float( columns ),s1:=float(x+1)/float( columns )Local t0:=float(y)/float( rows ),t1:=float(y+1)/float( rows )verts.Push( New Vertex3f( startX, startY, 0, s0,t0, 0,0,-1 ) )verts.Push( New Vertex3f( startX + cellWidth, startY, 0, s1,t0, 0,0,-1 ) )verts.Push( New Vertex3f( startX + cellWidth, startY + cellHeight, 0, s1,t1, 0,0,-1 ) )verts.Push( New Vertex3f( startX, startY + cellHeight, 0, s0,t1, 0,0,-1 ) )faces.Push( i+1 )faces.Push( i+2 )faces.Push( i+3 )faces.Push( i+1 )faces.Push( i+3 )faces.Push( i+4 )i += 4NextNextLocal data := New Mesh( verts.ToArray(), faces.ToArray() )data.FlipTriangles() 'initially triangles face away from camera, so this flips themdata.UpdateTangents()Return dataEndNever heard of struct WINDRECT__ before – try plain old RECT instead, works fine here:
https://msdn.microsoft.com/en-us/library/windows/desktop/dd162897(v=vs.85).aspx
Possibly time to start a win32 module?
Have you tried attaching code or zip of code?
If that’s not working, can you email code to me? blitzmunter at gmail dot com
SetScale is an algorithmic entity scale factor used by the renderer. It does not affect actual mesh vertex positions (as stored in memory) therefore does not affect mesh bounds either. If there was an Entity.Bounds, it would probably affect that though!
Mesh.TransformVertices and Mesh.FitVertices on the other hand *do* affect mesh vertex positions, so do affect mesh bounds.
In general, my advice for now would be to avoid SetScale if you’re using physics and build all your meshes at the right size in the first place. You can also use Mesh.FitVertices if you want to physically scale a mesh to a certain size etc.
I think the problem here is that SetScale doesn’t currently affect the physics, only the rendering, so the ground box looks big but is still only actually a unit cube as far as the phyics is concerned.
I’ll have a think about how best to deal with this but for now thje BoxCollider size will need to be it’s ‘actual’ size.
Yeah, sprites are very primitive right now and there are lots of changes coming. I will definitely keep your questions in mind though and try to address them as well as I can.
I just need to finish up the IAP mobile module this week, and then it’s back into the fun/interesting stuff!
Ha, Ok, found it.
The problem is the model has quite a few bones, 67 in all, and the shader only handles 64. I upped the shader array to 96 and it worked fine, will push this change soon. I need to do more research on what a ‘reasonable’ max number of bones is here.
Shame about the license. I am working on the assumption that ‘free for personal use’ models are a no-go, which is a bummer because there are a lot of good ones around!
Well, I’ve reproduced *something*! See attachment below….is this what you’re getting?
Note that loading with Model.Load instead of Model.LoadBoned fixes it, but of course it can’t be animated.
There are several issues with the model too – some vertices have >4 weights which is kind of a stock limit for GPU boning. I can fix this by normalizing bones weights which I will do, but animation will look a bit ‘stiffer’. Also, that particular model has what looks like some ‘errors’ in the weights in that a few of the weights are very, very small (eg: 1e-8) and will have little effect on boning.
Anyway, still on the laptop which is driving me nuts. Will fix it when I get my real computer back (soon) but I’m sure it is fixable.
Nice model too. Is it ‘free’ as in libpng/zlib license free? Can I add it to the monkey2 distro?
Attachments:
Note: I thought it might be github’s autocrlf feature, but chalky.fnt does actually appear to be stored at github with windows EOLs. Will experiment more when I get my real computer back!
Never used to have any problems with Prompt Invasion, but am now also having problems loading chalk.png at home on the laptop.
It appears to be trying to load chalky.png” (note extra quote at end) which is causing it to fail. This is in turn caused by the fact chalky.fnt has windows eol’s, so all lines actually end with “\r” after splitting by “\n”.
Adding line=line.Trim() at line 53 in font.monkey2 fixes it here. Not sure why it sometimes works though.
Ok, the main issue here is that Color is a struct, and structs aren’t currently reflected (hence the error ‘not a class or interface’).
This wasn’t an issue in bmx of course because it didn’t have structs, but I am yet to get them working properly with reflection in monkey2. I do plan to spend more time on reflection soon though and will be looking into this.
-
AuthorPosts
