Go Back   the Magicball Network > Forums > LBA Projects > Little Script Adventure

Welcome to the Magicball Network.

You are currently viewing our site as a guest which gives you limited access to view most discussions and access our other features. By joining our free community you will have access to post topics, communicate privately with other members (PM), respond to polls, upload content and access many other special features. Registration is fast, simple and absolutely free so please, join our community today!

If you have any problems with the registration process or your account login, please contact contact us.

Little Script Adventure An open-source 3D engine with assets and tools for all future LBA fan-games.

Reply
 
Thread Tools
  #2851  
Old 2011-11-13, 12:52
David's Avatar
David David is offline
Magic Ball Master
 
Join Date: Dec 2008
Location: Barcelona
Posts: 1,683
The light cone is normally defined by aperture angle instead of radius/distance, just like the camera cone.
The shader use an inner and outer cone, with linear fading between the two, and I've set outer angle to be 1.2 times inner angle. The outer angle will be the one you set on the interface.


The way light fades with the distance is inverse of the distance. I'm not sure this is the right formula.

About the light globe, I suggest to add a 3D model with _emis material. Note that if you add a spotlight with no surface close to it, you don't see any light.


We need a symbolic model for the omnilight, do you have one ?



Edit :
http://www.ozone3d.net/tutorials/gls...g_phong_p4.php
att = 1.0 / (Kc + Kl*d + Kq*d2)

where d stands for the distance between the position of the light and the currenlty processed vertex:
In OpenGL terms, attenuation factors are defined by:
glLightf( GL_LIGHT0, GL_CONSTANT_ATTENUATION, 0.0f ); glLightf( GL_LIGHT0, GL_LINEAR_ATTENUATION , 0.0f ); glLightf( GL_LIGHT0, GL_QUADRATIC_ATTENUATION , 0.0002 );
__________________
Little Script Adventure[thread][download]

Last edited by David; 2011-11-13 at 13:08.
Reply With Quote
  #2852  
Old 2011-11-13, 16:43
Horadrim's Avatar
Horadrim Horadrim is offline
Free-lance designer
 
Join Date: May 2004
Location: Bulgaria
Posts: 1,355
Send a message via ICQ to Horadrim
Okay, do as you know it should be. I`m just suggesting stuff. After all, I`m not a programmer :P. About the model, nope, I don`t have any omni models, but I`ll make one .
Reply With Quote
  #2853  
Old 2011-11-13, 18:38
Horadrim's Avatar
Horadrim Horadrim is offline
Free-lance designer
 
Join Date: May 2004
Location: Bulgaria
Posts: 1,355
Send a message via ICQ to Horadrim
Okay, the omni is ready, it`s in the repo. It uses the spotlight texture.
Reply With Quote
  #2854  
Old 2011-11-14, 01:01
David's Avatar
David David is offline
Magic Ball Master
 
Join Date: Dec 2008
Location: Barcelona
Posts: 1,683
I added a button to add omni light in main menu
Now if you right click (or press space)with a light selected you will have access to light properties.
Beware, the map format has changed to handle spotlights and omnilights. It's still compatible with older map if there have no lights inside, otherwise it will crash.

Next step is the particle editor I guess

Edit : and thanks for the omnilight model !
__________________
Little Script Adventure[thread][download]

Last edited by David; 2011-11-14 at 01:28.
Reply With Quote
  #2855  
Old 2011-11-15, 12:04
David's Avatar
David David is offline
Magic Ball Master
 
Join Date: Dec 2008
Location: Barcelona
Posts: 1,683
I created a museum scene, 100% based on already done work, the painting frame is made from 2D painting of Horadrim, and the scene is almost a copy of pharmacy. That scene introduce an idea about how to include fan art stuff and also is interesting for seeing lightspots in action.

__________________
Little Script Adventure[thread][download]
Reply With Quote
  #2856  
Old 2011-11-15, 14:14
Jasiek's Avatar
Jasiek Jasiek is offline
Do the evolution.
 
Join Date: Jul 2003
Location: You forgot Poland.
Posts: 7,723
Nice!

And I can see that the weird problem I had on my map is also visible on the floor there.
__________________
Little Script Adventure
Join the Little Script Adventure team
Download Little Script Adventure
Reply With Quote
  #2857  
Old 2011-11-15, 14:17
Horadrim's Avatar
Horadrim Horadrim is offline
Free-lance designer
 
Join Date: May 2004
Location: Bulgaria
Posts: 1,355
Send a message via ICQ to Horadrim
He he, very nice. I was thinking, that it might be good if we chop down the scenes in building blocks, so later they could be stiched in Blender or in MAX (or whatever app) and retextured, to make a new scene. BTW, I can`t help but notice the dark triangles in the right part of the pic, the same occurs in the pharmacy map, why is this happening?
Reply With Quote
  #2858  
Old 2011-11-15, 17:17
Jasiek's Avatar
Jasiek Jasiek is offline
Do the evolution.
 
Join Date: Jul 2003
Location: You forgot Poland.
Posts: 7,723
Quote:
Originally Posted by Horadrim View Post
He he, very nice. I was thinking, that it might be good if we chop down the scenes in building blocks, so later they could be stiched in Blender or in MAX (or whatever app) and retextured, to make a new scene. BTW, I can`t help but notice the dark triangles in the right part of the pic, the same occurs in the pharmacy map, why is this happening?
I've got the same in my map, some triangles are extremely shiny with a single colour and no texture - even though they're properly uvmapped. No idea what's happening.

About chopping them up: when making the outside map, I could make "building blocks" in a separate layers (like the corners, doors, windows, some straight pieces), with all the elements I'm using in the map. Maybe I could link to them too, so If I change one they all change in the map.
__________________
Little Script Adventure
Join the Little Script Adventure team
Download Little Script Adventure
Reply With Quote
  #2859  
Old 2011-11-15, 17:24
David's Avatar
David David is offline
Magic Ball Master
 
Join Date: Dec 2008
Location: Barcelona
Posts: 1,683
Now we have an editor I prefer to avoid linking. I propose creating more OBJ in same level folder for the blocks. I could add a reload button so that you see the changes you do on blocks while keeping camera at same position in the level scene.

I'll check what happens with those weird faces
__________________
Little Script Adventure[thread][download]
Reply With Quote
  #2860  
Old 2011-11-15, 17:33
Jasiek's Avatar
Jasiek Jasiek is offline
Do the evolution.
 
Join Date: Jul 2003
Location: You forgot Poland.
Posts: 7,723
Quote:
Originally Posted by David View Post
Now we have an editor I prefer to avoid linking. I propose creating more OBJ in same level folder for the blocks.
That's what I meant, basically. If there would be any linking it would be contained to a single .blend file. I'm not sure how that's done in Max.

Quote:
Originally Posted by David
I'll check what happens with those weird faces
Cool!
__________________
Little Script Adventure
Join the Little Script Adventure team
Download Little Script Adventure
Reply With Quote
  #2861  
Old 2011-11-16, 09:42
David's Avatar
David David is offline
Magic Ball Master
 
Join Date: Dec 2008
Location: Barcelona
Posts: 1,683
all the weird faces are rendering this way because of tangent computing

To understand what happen with those bad rendering you need to understand what are tangents : for a single face, tangent is the same as texture axis U. Without it, no bump nor parallax possible. The tangents are then averaged when there are shared vertices, so that the mesh rendering look smooth. Same idea than normal smooth group. Tangent is computed from vertices coords and UV coords.

OK, now I explain you what happens for each case.

On pharmacy map, you have some quads where 3 vertices have UV coords and 3D coods aligned, creating an edge instead of a triangle when quad is splitted. The tangent can't be computed, and all the faces sharing the bad vertices get wrong tangent too when tangents are averaged.

On nearpharmacy map, you have a quad with 2 vertices at same position, so same as above the tangent can't be computed, and all the faces sharing the bad vertices get wrong tangent too when tangents are averaged.

On harbor map, tangents are OK for each face, but you have 2 neighboor faces with oposite tangents, look at the UV unwrap. When tangents are averaged, the result is a zero tangent which leads to the bad rendering. You must avoid such a setup to get correct result.
Attached Thumbnails
Click image for larger version

Name:	bug.jpg‎
Views:	87
Size:	19.9 KB
ID:	8980   Click image for larger version

Name:	bug2.jpg‎
Views:	89
Size:	53.1 KB
ID:	8981   Click image for larger version

Name:	bug3.jpg‎
Views:	88
Size:	66.8 KB
ID:	8982  
__________________
Little Script Adventure[thread][download]
Reply With Quote
  #2862  
Old 2011-11-16, 18:07
Horadrim's Avatar
Horadrim Horadrim is offline
Free-lance designer
 
Join Date: May 2004
Location: Bulgaria
Posts: 1,355
Send a message via ICQ to Horadrim
Idk if it`s possible to compute the tangents otherwise, but this way as is now, it`s f$@#ing up the way we`re doing the textures. I mean - in the case with the pharmacy, the bricks should be rotated 90*CW or CCW, so the viewport`s Z axis to be aligned to the U axis of the texture. It seems that in MAX, the UV coords are flipped (i.e. Y stands for U and Z stands for V). So, it comes out that I should rotate most of the tileable textures by 90* and then rotate the box gizmo by 90*, while texturing, so the axises and the texture orientation could match. Are you sure that the U is the "up" for the textures?
Attached Thumbnails
Click image for larger version

Name:	coords.jpg‎
Views:	86
Size:	378.4 KB
ID:	8983  
Reply With Quote
  #2863  
Old 2011-11-16, 18:16
David's Avatar
David David is offline
Magic Ball Master
 
Join Date: Dec 2008
Location: Barcelona
Posts: 1,683
Why do you want to align viewport Z and U axis of texture ?
U in texture space is horizontal, and V vertical.
__________________
Little Script Adventure[thread][download]
Reply With Quote
  #2864  
Old 2011-11-16, 18:38
Horadrim's Avatar
Horadrim Horadrim is offline
Free-lance designer
 
Join Date: May 2004
Location: Bulgaria
Posts: 1,355
Send a message via ICQ to Horadrim
Well, I don`t want to align them, it seems that it`s the only way to fix the tangents issue. The axises of the textures are 3, not 2. It`s UVW and I suppose that this is the origin of the whole problem. You see, I`m using box unwrap for the walls, this kind of unwrapping adds the third axis (W), so the gizmo itself is a viewport modifier, which is a three dimensional object. By its walls I could determine which axis of the viewport corresponds to the texture axises. If I rotate this box by 90*, the tangent problem disappears, but this way, the whole texture is rotated by 90*, which requires me to rotate physically the texture image by 90*, so the bricks could appear horizontal, not vertical as in the screenshot above. Do you get my point?
Reply With Quote
  #2865  
Old 2011-11-16, 19:38
ambient's Avatar
ambient ambient is offline
Magic Level: Red Ball
 
Join Date: Jun 2010
Location: Russia
Posts: 141
Guys, tangent issue is very simple to solve. Use spherical linear interpolation for them. Yeah, that's not so simple as usual lerping, but it will yield correct results - no zero tangents.
__________________
Become one with Russia, da?
Reply With Quote
  #2866  
Old 2011-11-16, 20:15
David's Avatar
David David is offline
Magic Ball Master
 
Join Date: Dec 2008
Location: Barcelona
Posts: 1,683
@Horadrim : No I don't get your point. I don't see why we need 3 axis. A png image is 2D isn't it ?
The maps have correct unwrapping, you don't need to rotate anything. Only a few faces need to be corrected. If you update an OBJ I'll see what happen, and tell you how to correct it, did you check the 3 cases above ? Now I'm talking about it, there is a 4th case that need to be avoid : faces with different texture must not share vertices. It's the case of carpet.

@ambient, the solution you give will work yes, but won't give a correct parallax rendering. The problem is not how I compute tangent, but the unwrapping on a few faces.
__________________
Little Script Adventure[thread][download]
Reply With Quote
  #2867  
Old 2011-11-16, 22:53
Horadrim's Avatar
Horadrim Horadrim is offline
Free-lance designer
 
Join Date: May 2004
Location: Bulgaria
Posts: 1,355
Send a message via ICQ to Horadrim
What exactly should I correct in these faces? Jasiek remade the model I gave him long time ago and indeed there were some wrong made faces and overlapping edges, but today I remade the floor and some of the walls. I also quadrangulated the model and I export it each time as quads.
As for the UVW mapping, I understand your confusion, but if you look at his:
http://en.wikipedia.org/wiki/UVW_mapping

you might get some light over the issue. The png maps are 2D, yes, but you must understand that the way of texturing one mesh is one, and the image of the texture something else. In the next composite shot, you could see what I`ve described in my previous post. Note that in this sample, I should rotate only the bricks texture, to get everything to display as it should be.
Attached Thumbnails
Click image for larger version

Name:	coords.jpg‎
Views:	88
Size:	262.6 KB
ID:	8984  
Reply With Quote
  #2868  
Old 2011-11-16, 23:05
Horadrim's Avatar
Horadrim Horadrim is offline
Free-lance designer
 
Join Date: May 2004
Location: Bulgaria
Posts: 1,355
Send a message via ICQ to Horadrim
Also, take a look at this:
http://www.3dmax-tutorials.com/UVW_Map_Modifier.html

especially the part "XYZ to UVW".
Reply With Quote
  #2869  
Old 2011-11-16, 23:06
David's Avatar
David David is offline
Magic Ball Master
 
Join Date: Dec 2008
Location: Barcelona
Posts: 1,683
I need the obj you use on bottom left to understand what's happening
__________________
Little Script Adventure[thread][download]
Reply With Quote
  #2870  
Old 2011-11-16, 23:17
Horadrim's Avatar
Horadrim Horadrim is offline
Free-lance designer
 
Join Date: May 2004
Location: Bulgaria
Posts: 1,355
Send a message via ICQ to Horadrim
I comitted the both samples. Note that I`ve rotated only the texture of the outer wall (as shown on the shots).
Reply With Quote
  #2871  
Old 2011-11-16, 23:41
David's Avatar
David David is offline
Magic Ball Master
 
Join Date: Dec 2008
Location: Barcelona
Posts: 1,683
It's the 4th case. The faces named bricks2_matt.png cannot share vertices with the marble_shiny one. The UV are from 2 different UV islands, thus there is no continuity. Make this test : in MAX move a bricked face, and check only neighboor faces with brick texture move.

It works if you rotate UV 90 degrees, but if you had parallax enabled the render would be wrong.
__________________
Little Script Adventure[thread][download]
Reply With Quote
  #2872  
Old 2011-11-16, 23:52
Horadrim's Avatar
Horadrim Horadrim is offline
Free-lance designer
 
Join Date: May 2004
Location: Bulgaria
Posts: 1,355
Send a message via ICQ to Horadrim
What do you mean by "move a bricked face"?
Reply With Quote
  #2873  
Old 2011-11-16, 23:57
David's Avatar
David David is offline
Magic Ball Master
 
Join Date: Dec 2008
Location: Barcelona
Posts: 1,683
to drag a face which has texture bricks2_matt.png
__________________
Little Script Adventure[thread][download]
Reply With Quote
  #2874  
Old 2011-11-17, 00:03
Horadrim's Avatar
Horadrim Horadrim is offline
Free-lance designer
 
Join Date: May 2004
Location: Bulgaria
Posts: 1,355
Send a message via ICQ to Horadrim
If you speak about the model, there are no gaps between the edges, I`ve checked few times.
BTW, why don`t you enter the LBA channel on IRC as before, so we could chat freely, instead of waiting each other to post here?
Reply With Quote
  #2875  
Old 2011-11-17, 02:23
Jasiek's Avatar
Jasiek Jasiek is offline
Do the evolution.
 
Join Date: Jul 2003
Location: You forgot Poland.
Posts: 7,723
I fixed my map - all is well
__________________
Little Script Adventure
Join the Little Script Adventure team
Download Little Script Adventure
Reply With Quote
Reply

Tags
awesome, demo, engine, lba, lba1r, little bigger adventure, little script adventure, non profit, opengl, opensource, tools

Thread Tools

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

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Link on mbn main page Vral The site and forum 19 2005-11-04 06:17
main page Neko LBA DM 3 2001-04-29 23:12
Why does no one visit the main site? CS2x The site and forum 42 2001-02-01 19:24


All times are GMT +2. The time now is 14:03.


News Feed
Powered by vBulletin®
Copyright ©2000 - 2021, Jelsoft Enterprises Ltd.
Copyright ©2000 - 2021, the Magicball Network