Login Action Required

The NinevehGL Forum uses a new concept of "socialized forum" or as we like to say "Tweet Forum".


Here is the deal:
  1. No new registration is required. Just sign in with your Twitter account and authorize the NinevehGL Forum.
  2. Once you’re in, you'll be able to "Follow a Thread", that means every time that thread receive a new post or update you'll receive a mention on your twitter.
  3. Besides, you can enable "Auto Share", then every new post and/or thread you make will be tweeted on your timeline. (By default, auto-share is enabled only for your threads)

Forum Rules:

1. We understand human comunication can become "hot" sometimes. So some insults and bad words ARE allowed. Just don't push too much being an asshole all the time.

2. SPAMMERS are not allowed. There are penalties for this kind of user and they can be banned forever.

3. You can report other users, if you judge necessary. An user reported many times by many people can also be banned forever. However you can also receive penalties for report deliberately for no apparent reason.

If there is a similar thread title, make sure the other one doesn't already have the answer you're looking for.

This forum uses the BBCode (Bulletin Board Code), here are some instructions:

Bold: [b]text[/b]
Italic: [i]text[/i]
Underline: [u]text[/u]

Code: [code]text[/code]
Quote:
[quote=@username]text[/quote]
[quote]text[/quote]

List:
[ul] [*]item [/ul]
[ol] [*]item [/ol]

URL:
[url]http://url.com[/url]
[url=http://url.com]text[/url]

Image:
[img]http://imageurl.com[/img]

Embed (videos, code, 3D):
[embed]http://url.com[/embed]

Welcome to the NinevehGL's world!
NinevehGL is a 3D engine forged with pure Obj-C.
Welcome to the
Forum!
Hello, Guest.

Your current vote:

You can change your vote many times. But it's still one single vote.

Retain Mesh color without kNGLNormalize
Vote this thread:


@sashah_t

Posts: 27

NGLNewbie

Tue, Jul 23 2013


Hello,

I decided I should make my own thread with this question.
I posted a question at the bottom of this thread: http://nineveh.gl/community/forum/how_parameter_knglmeshkeynormalize_works
because in following the instructions there I was able to load multiple meshes in the correct size and location in relation to one another.

I have a NGLGroup3D filled with several non-normalized meshes that is then scaled using setScaleX, setScaleY, and setScaleZ. The problem is that when the meshes were normalized, they had their proper colors, and after removing normalization all the colors are black or very near to black.

So I have:

NGLGroup3D* _meshArray;
NSDictionary *settings = [NSDictionary dictionaryWithObjectsAndKeys:
nil];
_mesh = [[NGLMesh alloc] initWithFile:fullFilePath settings:settings delegate:self];
_mesh.rotationSpace = NGLRotationSpaceWorld;
[_meshArray addObject:_mesh];
[_meshArray setScaleX:.0001];
[_meshArray setScaleY:.0001];
[_meshArray setScaleZ:.0001];


Removing the setScales and adding in
@"0.1", kNGLMeshKeyNormalize,
to the dictionary brings the color back but since each mesh is normalized individually they no longer line up and have the correct sizing.

Any way to have the meshes in the right place with the right colors?

Thanks,
0% like this - 0/0

@sashah_t

Posts: 27

NGLNewbie

Tue, Jul 23 2013


In response to: @sashah_t

I have found that by adding

nglGlobalLightEffects(NGLLightEffectsOFF);
I can see the colors, but the surface looks flat.

So it is a lighting problem as I suspected, can anyone help me setup the correct lighting for a non-normalized mesh?
I could make my own shader but because I don't yet understand shaders I would prefer using the defaultLight supplied.
0% like this - 0/0

@dineybomfim

Posts: 571

NGLAdmin

Tue, Jul 23 2013


In response to: @sashah_t

Hi,

Well, working programmatically in 3D space is not an easy task, requires a lot of abstraction. You can check the light's docs http://nineveh.gl/docs/Classes/NGLLight.html

You'll solely work with light position and attenuation attribute to make it as you wish.

My advice is to forget about lights and think about "rendering lights to textures". It's a 3D technique to achieve great levels of performance avoiding real time lighting calculations.
100% like this - 1/1

@sashah_t

Posts: 27

NGLNewbie

Tue, Jul 23 2013


In response to: @dineybomfim

The attenuation factor has helped, the objects now show the color but they are still darker than normal. I set attenuation all the way to the max of 1000 and need it to be brighter still.

How is the position value changed? I tried setting the scale of x,y,and z and that caused no change.

We receive the .obj and .mtl files from a customer so we must have these textures applied correctly to the mesh itself and cannot use "rendering lights to textures".

Thanks!
0% like this - 0/0

@sashah_t

Posts: 27

NGLNewbie

Tue, Jul 23 2013


In response to: @sashah_t

Nevermind! I figured out how to move the light. It seems to me that this problem was caused by the object being too large without normalization. It was black because the light ended up inside the object!

Fixed using
[NGLLight defaultLight].attenuation = 1000; 
[[NGLLight defaultLight] setZ:2000];
though the numbers still need a little tweaking I think.

Thank you so much for explaining attenuation and pointing out the need to move the light.
100% like this - 1/1

@sashah_t

Posts: 27

NGLNewbie

Tue, Jul 30 2013


In response to: @sashah_t

In case anyone else has this problem, it turns out it was better to scale the individual meshes before adding them to the group than to scale the entire 3dGroup. This way the original lighting is still valid and yet there are no problems with normalization.
0% like this - 0/0
Technology

NinevehGL is a 3D engine built right on top of OpenGL ES and it uses all the programmable pipeline power, making it easy for you to create great application with shaders.

Share on


Follow NinevehGL
Fastest way to contact us:

Copyright © 2011 db-in. All rights reserved.