• Create Account

# Turbochist

Member Since 26 Oct 2013
Offline Last Active Today, 06:22 AM

### GLSL optimization. What is faster?

16 April 2016 - 03:15 AM

I'm using OpenGL ES.

And have two types of calculation "dir" vector, which code is fastest?

```attribute vec2 order;
```

code1:

```  if( abs(sinA) < 0.2 ) {
if(order.x == 1.0){
dir = sNormalPrev;
} else {
dir = sNormalNext;
}
} else {
dir *= order.x / sinA;
}
```

code2:

```float k = step(0.2, abs(sinA));
dir = k * dir * order.x / sinA - (k-1.0) * (step(1.0, order.x + 1.0) * sNormalPrev + step(1.0, -order.x + 1.0) * sNormalNext);

```

### How to calculate sun and planets positions around the Earth by real date and time?

24 March 2016 - 02:40 PM

Hello! Hello!

This is very interesting question! Ive read a lot of articles saw a lot of sources and dont understand yet. But first of all.

I m making Google Earth like 3d Earth programm, and interesting how to place the Sun to the right place respect the Earth. I have date and time. Could you help me(and maybe other google searching people) to understand how to place the sun(and maybe other planets) to the right place in 3d cartesian space by date time.

Thank You!

### How to draw 3d billboard fixed independent distance size?

26 October 2015 - 02:32 PM

How to draw 3d billboard fixed independent distance size?

I'm using this:

float viewAngle = 35.0 * 3.14/180.0 * 0.5;
float dist = length(billboardPosition - cameraPosition);
float ratio = screenWidth/screenHeight;
float size = dist * 2.0 * tan(viewAngle)/(screenWidth/ratio);
float scaleX = billboardWidth * size;
float scaleY = billboardHeight * size;

This works, but fixed billboard size little enlarges near the horizontal screen edges.

How to make it real constant size?

Could you plese describe it more clear, thanks))

### Billboard independent distance size how to?

25 October 2015 - 02:56 PM

Hi!

I use this scale function to scale billboard to the cosntant size, but size enlarge on the near left and right borders.

float scale = size * dist * 2.0 * tan(fov)/(screenWidth/ratio)

How to make 3d billboard same saize on the whole screen space? Without ortho projection))

### Normal map artifact still here.

31 October 2014 - 08:12 AM

I've made simple terrain normals into texture rendering function(without tanget and bitangent calculations). And picture had became good.

but there is like vertex lighting artifacts still here

Is it can be solved?

PARTNERS