Wednesday 3 August 2016

Formatos 3D

3D Formats

OBJ - List of points followed by incidences (triangle vertex). Just like FEM files
# www.zbrush.com
#Vertex Count 54630
#Face Count 109256
v 0.68168121 1.8563795 0.35159689
f 9900 36020 20005

Monday 18 July 2016

Muitos meses depois - Trail

Depois de 8 meses sem provas e com ritmo de treino intermitente mas sempre em Monsanto com os Esquilos, fiz duas provas de seguida.



A primeira foi o Trail da Louza, 17km, com o André. Foi o primeiro trail, não fazia a mínima ideia ao que ia, pensava que ia ser como os treinos das 6 da manhã, em que se corre sempre ou quase sempre. Pois aqui primeiro não ia sozinho, depois estava muita gente no trilho e as subidas não têm nada a ver com as de Monsanto. Fui bastante mais devagar do que iria sozinho mas quase nunca me custou, excepto no fim quando estava a ficar atrasado para a viagem.



Subidas e descidas de assustar, inclinações de 30% (medidas a olho), pedra solta, ribeiras e abastecimentos saborosos com nutela e batata frita.





Passadas duas ou três semanas, foi a vez de voltar ao berço. Sou de Lisboa e do mar e do Guincho, mas metade vem da serra e é aí que tenho o meu nome nas pedras do cemitério. De novo o André desafiou-me e eu fui. Só chegar lá já foi complicado, mas a M. deixou-me no Porto e o Pedro Nuno levou-me. Pusemos a conversa em dia até Tendais e fomos directos para o Solar do Montemuro. Na entrada encontrei o Kiko Martins a beber uma imperial e a ver a vista ou a pensar na vida ou a sossegar, pois ia fazer os 70km. Dois dedos e conversa e fui ter com o Tio Carlos e o André. Soube mesmo bem estar ali a jantar com eles, ainda por cima a comer bem. Sinto-me querido ali e a reatar os tempos de criança em que passámos Natais e férias de verão no calor.



Fomos para casa, atirei para o chão a tralha que achei que ia precisar no domingo, o André deu-me umas dicas, pus o despertador e fui dormir por cima do saco-cama.



Acordei antes das sete, vesti-me e já estava quente. Lá fora o dia já estava adiantado, o que metia medo. O plano era começar a andar para habituar o joelho e não me matar nos 11km a subir do principio, sabendo que não tenho stamina para 38km nem perto disso. E devagar eu fui, mesmo devagar. Andando e correndo uns poucos cheguei fino, quase às 10h da manhã, ao S. Pedro. Levava grande parte do desnível feito e o joelho e perna estavam a portar-se bem. Tudo calmo, tudo sereno.



E encontrei o Kiko, ou melhor, a Maria, a mulher dele à espera dele no abastecimento. E arranquei com ele e o companheiro dele. E comecei-me a divertir. Sempre a correr, descer subir descer trepar sempre a abrir. Eu com medo dos tombos e do ritmo, de ir depressa demais para mim ou para eles, mas principalmente a tentar imaginar onde ia acabar o gás. Mas depressa de mais acabou a piada, ao fim de poucos km as provas voltaram a bifurcar. Disse adeus e segui por um caminho de juntas e eles por um lameiro. O meu ritmo baixou e desanimei. Pensei que se dane e voltei para trás o mais depressa que pude, a pensar que talvez nem os apanhasse porque eles iam perto do meu limite, mas encontrei-os depressa e expliquei-me "Vou junto até onde der". Não disseram grande coisa, não sei o que pensaram, se é que pensaram e continuámos. Numa subida grande por um ribeiro seco em direcção às Portas andámos bastante, o Kiko ia mal da barriga e o Zé? falava de um medicamento para as articulações. Ainda esperei uns pedaços por eles numas subidas. Depois o Kiko melhorou e voltámos a correr bem.

Chegámos às eólicas no lado da serra que dá para Castro Daire, mais a Sul e andar por essa encosta sul com a Seera da Estrela ao longe foi a parte épica da prova. Estava-me a a aguentar bem ao ritmo, a subir e a descer, mas sempre a queimar. Encontrámos uns quantos dos 70 e fomos juntos do abastecimento para baixo mas separá-mo-nos depressa, acho que nós íamos mais depressa. E continuei, passámos postos já nas aldeias até que chegámos a Quinhão onde encontrei o André!



E mesmo sem saber eu já estava perto do fim. Levava uns 30km em cima, 11 a subir devagar e 20 completamente over my head. Umas subidas à frente senti-me a fraquejar mas aguentei. Junto do Bestança apareceu uma subida curta mas muito forte a ligar do caminho à levada e senti um castigo enorme por todo o corpo. Depois veio uma subida em que andámos todos mas eu só queria andar devagar, devagar, cada passo era uma ordem. A expectativa era nula, não ia conseguir acompanhar. Disse adeus e agradeci, deram-me uma experiência enorme. Continuei a andar à procura de uma sombra e soube mesmo bem. Passado poucos minutos encostaram mais dois dos 70km, descansaram e fomos até ao posto de Soutelo. Ainda comi e arranquei mas foram 5km fáceis, cheio de planos, descidas e sombra, que fiz a lamber as últimas gotas do depósito, andar, correr, andar, suspirar.



Cheguei ao antepenultimo posto e parei o Garmin. Tinha os 38km no bucho, tinha rebentado, tinha andado por onde não devia e como não devia e soube muito bem! Ir até Cinfães em arrasto não me dizia nada, desta vez. Esperei uma hora por boleia e fui com os bombeiros que me deixaram directo à porta de casa.



Friday 17 June 2016

Importing from Sketchup to Unity

Architectural models from Sketchup have been working straight away when they get to Unity. There is no need to convert them to an intermediate format, the .skp files are good enough. I have this linkedin post (also got a pdf) on importing via .fbx that I didn't try yet cause it wasn't necessary.
Questions to investigate:

  1. tried importing in skp format from current Sketchup (June2016) version and it doesn't work, but when trying from older version it works.
  2. we need the Pro version to export to .fbx
  3. is it better to use fbx or skp?

Tuesday 5 April 2016

Pipeline modelo com Oculus - desactualizado com a versão 5.

Tenho um Doc word chamado "Pipeline_Unity_OculusRift.docx". Abaixo está uma versão sem imagens.

Geração de modelos básicos para Oculus Rift em Unity
Descrição – permitir navegação com Oculus Rift em geometrias importadas de programas de modelação 3D (Sketchup, Blender, Rhino, 3DsMax, etc.).

Configuração do Unity para Realidade Virtual

Settings Globais
Ir ao menu Edit\Project Settings\Player e activar Virtual Reality Supported no Inspector (lado direito).

Importar Assets do Oculus Rift para Unity

Descarregar package “OculusUtilities” do site do Oculus Rift: Developer/Downloads/Engine Integration. Verificar compatibilidade com a versão do Unity que estamos a usar. Se necessário actualizar o Unity.
Unzip do ficheiro e arrastar o package para os Assets ou ir a Assets/Import Package/Custom Package. Aceitar a importação de todas as partes do pacote.
Nos Assets, abrir a pasta OVR/Prefabs e arrastar o OVRPlayer para a Scene. Depois pode-se afinar a posição do player em relação ao modelo.

Modelo 3D: importar e modificar

1 – Importar modelo 3D. Modelo tem de estar em formato aceite pelo Unity. Para importar basta arrastar ficheiro para os Assets. É boa ideia organizar os Assets em pastas. Verificar se geometria está correcta, materiais em texturas sobreviveram à importação, etc.
2 – Arrastar modelo para a cena, clicar e pôr o seu centro nas coordenadas 0,0,0. Se os modelos estão em coordenadas muito longe do centro (milhares de metros) podemos ter problemas.
3 – Expandir modelo na Hierarquia (lado esq.), seleccionar todas as peças do modelo e seleccionar Add Component no Inspector (lado direito): Physics->Mesh Colider. Isto faz com que todos os polígonos passem a ser impenetráveis para o avatar (é um pouco dispendioso mas é o mais simples).


Carregar Play e navegar, com ou sem Oculus.

Tuesday 15 March 2016

Learning Resources on Computational GRaphics

3Ds MAx on Lynda.com

After taking the first course, which I did not finish since I ain't interested in animationa and advanced lighting, etc. I signed up for a trial account at digital tutors, which is also prety good. The videos I watched from this short course, CG101 are prety good and explains very well the concepts.

So now I need to learn 3DS or other 3D modeling sftware to be able to manipulate the Salamonde model from Autocad 3D. So I'm taking this course 3ds Max 2013 Essential Training and hope that 2013 is not so far away from 2016.


Some more sites on CG

http://www.scratchapixel.com/lessons/3d-basic-rendering/global-illumination-path-tracing

http://home.lagoa.com/2014/04/ray-tracing-vs-path-tracing-in-plain-english/

Monday 14 March 2016

Materials

There are 2 kinds (at least for now)

  • Physical materials govern colisions: rebound, friction, etc.
  • Visual (?) materials govern the interaction with light (that's a very correct way of putting it). They call this Materials. I'll discuss.
Material (visual) properties:
  • Albedo -  In reality the definition of albedo is the percentage of light it reflects, whiteness - blackness, but here they use it for the color when there is no light (strange...maybe they mean under neutral, white light). Albedo comes from latin albus =  white. We can assign one value to the whole oblect or a map.
  • Metalic (map and slider) - the way it reflects light,
  • Roughness - more on the way it reflects light, see diffuse and specular to know more, later on.
  • And there are more maps which can be stored in the chanels of the rgb+alpha images 
WHat I don't know yet is how the maps are atributed to the geometry!


Sunday 13 March 2016

Colisions

This video explains the logic well. Must assign colision properties to objects. The easiest way is to assign Mesh coliders, but it is expensive since the engine must keep track of all the polygons. Most times we can use box or sphere coliders and set them in a smart way.

Animation

For now I'm not to worried about this but what I learned:
animations are created in Maya or 3Ds or Blender, Unity is not good;
creating a character has three steps: modelling (building the model mesh), rigging (the skeleton and the logic and hierarchy and skinning (joininng the two);

Friday 11 March 2016

Lighmaps UV

This expression keeps popping up from time to time, had to investigate.

So lighmapping is a way of baking light effect in objects. It only works for static objects and static lights. As is is baked it is not calculated in realtime. In reality a new texture incorporating the effect of lighning replaces the material's native texture and the light can be eliminated (or at least we don't need to calculate it's effect on that object in real time). Great video here.

Wikipedia page

Light in general in Unity

Lighmaps in Unity (starting point)

Now another question that I didnt understand is this UV mapping, though I think I have an idea that this is similar to the way FLAC2D from Itasca works, with local coordinates.

So this answer is great.

UV are the local coordinates of a flat surface with U and V going from 0 to 1. This video explains well what and how a UV map is built, but it really is the "skin" of the object taken out, cut in strategic places and stretched out and mapped in the coordinates.

Thursday 10 March 2016

Normal maping

I came accross this very cool concept on a Unity video @ Lynda's course. The idea is to record surface detail of an object by taking the surface normals on an image using RGB to represent the normal vector components in each pixel.
Then we can degrade the mesh but use the normal map of the detailed version on the degraded mesh. Of course the lights must nknow how to deal with this geometrically flat surface containing detailed information on the relief. Very cool!

Because most of the surfaces will have normal normals (pointing out of the surface, a big part of the normal maps will be kind of blue, i.e. flat.



Normal mapping is a kind of Bump mapping. We can also record elevation coordinates. With these we can really deform the surface or we can use the surface topograpfy just for interaction with light.

Wikipedia for normal mapping
Wikipedia for bump mapping
Unity for normal mapping, very complete!

Tuesday 8 March 2016

Learning Unity on Lynda.com - Part 1

Decided to take a structured Unity course to gain some structured learning. The disadvantage is that I'll have to go through stuff that doesn't mater much to me, since I'm not really developing games. More on that latter. Tha advantage is that I won't loose time looking at stuff done for older versions, repeated content and, more important, I have a structure to follow, there is always one more video to watch.

As to not developing a game, I guess that what I want to do will contain most of the components of a game.

So what I did is take a 10 day free trial on Lynda.com from Linkedin (which now wons Lynda, which makes sense) and started this course. Then I found out that the trial is for the Basic Lynda membership, which does not allow me to download the course files. Up to recently I never paid for content online, today I find that sometimes it is really worth it (maybe I now appreciate that my time is finite and valuable). I guess I'll be signing up for a Premium membership for about 25€/month, at least while learning Unity, 3DS Max and Revit.


Monday 7 March 2016

BIM and Virtual Reality - Visualization in demanding conditions

BIM visualiation is demanding due tothe large number of objects on screen. According to this paper "Real-time visualization of building information models (BIM) - Current state vs. state-of-the-art" by Mikael Johansson and Mattias Roupé we have three strategies to accelerate:
  1. GPUcentric optimizations - maximize the raw processing power of modern GPUs. E.g. arrange the draw-order of objects by material properties to minimize state changes. It is not indefenitable scalable. 
  2. Level-of-detail - reduce the complexity of a 3D object representation when the object is far away from the current viewpoint, but who produces the simplified models?
  3. Visibility culling - only sending objects that are potentially visible to the GPU. Two kinds of culling:
    1. frustum culling, where objects are discarded if they are found to be outside the visible region of space, as defined by the virtual camera
    2. occlusion culling the: discard objects that are guaranteed to be hidden in the final image. Harder to implement but very efficient in buildings
This paper compared performance for the three viewers and they are all bad:
  • Tekla BimSight
  • Autodesk Navisworks
  • Solibri Model Viewer (the best by far).