Oni Central Forum

A forum for the Oni community

You are not logged in.

#1 11/7/17 10:05

s10k
Member
From: Portugal
Registered: 14/1/07
Website

Adding lights to custom levels

Hi,

As anybody been able to add lights to custom levels?

I would like to add lighting like these (original game):
Oni%202017-07-11%2016-16-13-54.png
Oni%202017-07-11%2016-16-55-19.png
Oni%202017-07-11%2016-16-37-40.png

to my custom level. I'm using sketchup.

I've installed this sketchup plugin:
https://www.twilightrender.com/index.ph … s-twilight

But I couldn't get it to work.

Last edited by s10k (11/7/17 10:32)

Offline

#2 11/7/17 10:23

Iritscen
Moderator
From: NC, USA
Registered: 22/10/07

Re: Adding lights to custom levels

Are you talking about adding lights like the ones in your screenshot, or adding lighting to a level?  Because the two have nothing to do with each other.  The lights are just 3D models with lens flare sprites attached, and the "lighting" is pre-baked vertex shading.


byproducts are fine, but where's the beef?

Offline

#3 11/7/17 10:29

s10k
Member
From: Portugal
Registered: 14/1/07
Website

Re: Adding lights to custom levels

Its lights like in the screenshots. I'm sorry but I'm a completely newbie with this stuff.

Last edited by s10k (11/7/17 10:30)

Offline

#4 11/7/17 14:46

paradox-01
Member
From: Germany
Registered: 14/1/07

Re: Adding lights to custom levels

Theoretically you could create OFGA files and use them with the Furniture.xml
Advantage: no need to set particle locations.
Disadvantage: nailing down the OFGA location isn't very comfortable.

Or you use the particle collection.
Disadvantage: Every time you move the light emitting objects, you also need to re-adjust the particle locations.
Advantage: the 3d objects can be easily moved in sketchup and the rotation of the lensflare doesn't matter as their orientation is always towards your screen.

If you can't find the original particles you want in the particle collection file, check also the ENVP section in the ONLV file.

Last edited by paradox-01 (11/7/17 15:03)

Offline

#5 11/7/17 15:17

s10k
Member
From: Portugal
Registered: 14/1/07
Website

Re: Adding lights to custom levels

Thanks paradox! This is exactly what I was looking for. I'm going to investigate more.

Offline

#6 17/6/18 8:39

s10k
Member
From: Portugal
Registered: 14/1/07
Website

Re: Adding lights to custom levels

Hi everyone,

I just noticed this nice red lighting effect in neuro (in the wall and floor):

oni_red_light_effect.png

Is this "pre-baked vertex shading"? How can I add these to a custom level?

Offline

#7 17/6/18 9:15

Iritscen
Moderator
From: NC, USA
Registered: 22/10/07

Re: Adding lights to custom levels

Yes, it's vertex shading (AKA vertex coloring).  See the section starting here for paradox's tutorial.


byproducts are fine, but where's the beef?

Offline

#8 17/6/18 10:30

s10k
Member
From: Portugal
Registered: 14/1/07
Website

Re: Adding lights to custom levels

Thanks!

I would add some of these effects to my custom level. There's specially one arena that would benefit so much from this technique.

Is there any way to add these effects without using XSI?

Maybe with XML?

Or could I use a different model and apply vertex coloring using script the command env_shade to it?

Maybe we can do it also on sketchup (not sure if it supports it)?

Offline

#9 17/6/18 11:12

paradox-01
Member
From: Germany
Registered: 14/1/07

Re: Adding lights to custom levels

Might be that blender improved its buggy vertex shading code for DAE by now. https://blender.stackexchange.com/quest … tex-colors
Didn't test.

However, you would have to make sure that OniSplit reads that file.
If not, you have to adapt/repair the code. DAE is pretty much XML.

Offline

#10 17/6/18 11:21

s10k
Member
From: Portugal
Registered: 14/1/07
Website

Re: Adding lights to custom levels

Thanks paradox-01 I will have a look at this later. wink

Offline

#11 Yesterday 11:51

s10k
Member
From: Portugal
Registered: 14/1/07
Website

Re: Adding lights to custom levels

Seems latest blender already supports saving the vertex color. Unfortunately I can't get it working with onisplit.

When export the dae file with the vertex color in blender and I try to convert it with oni split I always get this error:

Geometry 'SketchUp' does not contain texture coordinates.

Ignoring 2 degenerate polygons

Geometry 'SketchUp_001' does not contain texture coordinates.

System.IndexOutOfRangeException: ndice fora dos limites da matriz.

   em Oni.Dae.Source.ReadVector4(Source source, Int32 index)

   em Oni.Dae.Source.ReadColor(Source source, Int32 index)

   em Oni.Akira.AkiraDaeReader.ReadPolygonPrimitives(Node node, MeshPrimitives primitives, MaterialInstance materialInstance)

   em Oni.Akira.AkiraDaeReader.ReadGeometryInstance(Node node, GeometryInstance instance)

   em Oni.Akira.AkiraDaeReader.ReadNode(Node node)

   em Oni.Akira.AkiraDaeReader.ReadScene(Scene scene)

   em Oni.Level.LevelImporter.ImportModels(XmlReader xml, String basePath)

   em Oni.Level.LevelImporter.ReadModel(XmlReader xml, String basePath)

   em Oni.Level.LevelImporter.ReadLevel(XmlReader xml, String basePath)

   em Oni.Level.LevelImporter.Read(String filePath)

   em Oni.Level.LevelImporter.Import(String filePath, String outputDirPath)

   em Oni.Program.ImportLevel(String[] args)

   em Oni.Program.Execute(String[] args)

   em Oni.Program.Main(String[] args)

System.IndexOutOfRangeException: ndice fora dos limites da matriz. -> this translates to Index out bound on the matrix.

I also tried env_shade command and it works, but unfortunately it seems to apply all the color equally without any "lighting effect".

Last edited by s10k (Yesterday 11:53)

Offline

#12 Yesterday 12:45

paradox-01
Member
From: Germany
Registered: 14/1/07

Re: Adding lights to custom levels

Alright, blender still sucks big_smile

From here on you would need to do .. what do they call it? Basic research?
Make a vertex-shaded cube in XSI.
Make a vertex-shaded cube in blender.
Compare the two DAE's XML code and write a program to transform your blender DAE files into a XSI-like DAE.

Edit: On a second thought you should test something else too: does the import work without vertex colors, when the DAE was simply re-saved in blender. That would give you a hint whether there's another problem.

env_shade
"If you use env_shade use it with caution. It completely overwrites the vertex coloring."
Ey, yes. All or nothing...

Last edited by paradox-01 (Yesterday 13:23)

Offline

#13 Yesterday 14:32

s10k
Member
From: Portugal
Registered: 14/1/07
Website

Re: Adding lights to custom levels

@paradox-01

Edit: On a second thought you should test something else too: does the import work without vertex colors, when the DAE was simply re-saved in blender. That would give you a hint whether there's another problem.

Yes it does! smile And it works perfectly in the game (at least the small part that I have imported).

From here on you would need to do .. what do they call it? Basic research?
Make a vertex-shaded cube in XSI.
Make a vertex-shaded cube in blender.
Compare the two DAE's XML code and write a program to transform your blender DAE files into a XSI-like DAE.

That's actually a good idea. There's a problem though, I can't run XSI for some reason (remember the weird problem that I had?).

Could you help me a bit with this one? Just do the XSI part, use this simple cube dae (3x3x3m cube) and apply a simple vertex shader and post it here. (just do this when you have some free time)

I will do the remaining, I will try to do that in Blender and compare both XML files.

Hopefully I can figure out where the vertex shade part is different, and create a patch file for XmlTools (to convert from Blender to XSI format).

If I can find what is different maybe we could later tell that to neo so he could also add support for vertex shader from blender on OniSplit.

Last edited by s10k (Yesterday 15:08)

Offline

#14 Yesterday 14:59

s10k
Member
From: Portugal
Registered: 14/1/07
Website

Re: Adding lights to custom levels

Btw I just did the blender part:

added_red_vertex_shader_blender.png

File exported with blender:

cube333_from_sketchup_added_red_vertex_shader_blender.dae

Offline

#15 Today 15:06

paradox-01
Member
From: Germany
Registered: 14/1/07

Re: Adding lights to custom levels

When I load that cube into XSI the vertex-colors were discarded.
The XML says it was made with 2.79.
The cube I colored yesterday in blender 2.8 still had vertex colors in XSI.
Question is: is that behavior due to the different blender versions or due to your cube's origin: Sketchup.
More, tomorrow.

Last edited by paradox-01 (Today 15:10)

Offline

Board footer

Powered by FluxBB